1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package devinstance
import (
"path/filepath"
)
func (l Layout) KcpDir() string { return filepath.Join(l.StateDir, "kcp") }
func (l Layout) SlotRoot(slot string) string { return filepath.Join(l.KcpDir(), "slot-"+slot) }
func (l Layout) SlotUnit(slot string) string { return l.Names().Slot(slot) }
func (l Layout) FrontUnit() string { return l.Names().Front() }
func (l Layout) FrontControl() string { return filepath.Join(l.RuntimeDir, "front.sock") }
func (l Layout) FrontState() string { return filepath.Join(l.KcpDir(), "front.json") }
func (l Layout) SharedDir() string { return filepath.Join(l.KcpDir(), "shared") }
func (l Layout) SlotsFile() string { return filepath.Join(l.KcpDir(), "kcp-slots.json") }
func (l Layout) FrontKubeconfig() string { return filepath.Join(l.KcpDir(), "admin.kubeconfig") }
func (r *Record) RemoveUnit(role string) {
out := r.Units[:0]
for _, u := range r.Units {
if u.Role != role {
out = append(out, u)
}
}
r.Units = out
}