github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/orbiter/kinds/clusters/kubernetes/current.go (about) 1 package kubernetes 2 3 import ( 4 "sync" 5 6 "github.com/caos/orbos/pkg/tree" 7 ) 8 9 type CurrentCluster struct { 10 Status string 11 Machines Machines 12 } 13 14 type Machines struct { 15 // M is exported for yaml (de)serialization and not intended to be accessed by any other code outside this package 16 M map[string]*Machine `yaml:",inline"` 17 mux sync.Mutex `yaml:"-"` 18 } 19 20 func (m *Machines) Delete(id string) { 21 m.mux.Lock() 22 defer m.mux.Unlock() 23 delete(m.M, id) 24 } 25 26 func (m *Machines) Set(id string, machine *Machine) { 27 m.mux.Lock() 28 defer m.mux.Unlock() 29 30 if m.M == nil { 31 m.M = make(map[string]*Machine) 32 } 33 34 m.M[id] = machine 35 } 36 37 type Current struct { 38 Common tree.Common `yaml:",inline"` 39 Current *CurrentCluster 40 } 41 42 type Machine struct { 43 Joined bool 44 Updating bool 45 Rebooting bool 46 Ready bool 47 FirewallIsReady bool 48 Unknown bool 49 Metadata MachineMetadata `yaml:",inline"` 50 } 51 52 func (m *Machine) GetUpdating() bool { 53 return m.Updating 54 } 55 56 func (m *Machine) SetUpdating(u bool) { 57 m.Updating = u 58 } 59 60 func (m *Machine) GetJoined() bool { 61 return m.Joined 62 } 63 64 func (m *Machine) SetJoined(j bool) { 65 m.Joined = j 66 } 67 68 type Versions struct { 69 NodeAgent string 70 Kubernetes string 71 } 72 73 type MachineMetadata struct { 74 Tier Tier 75 Provider string 76 Pool string 77 Group string `yaml:",omitempty"` 78 } 79 80 type Tier string 81 82 const ( 83 Controlplane Tier = "controlplane" 84 Workers Tier = "workers" 85 )