github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/orbiter/kinds/providers/static/current.go (about) 1 package static 2 3 import ( 4 "github.com/caos/orbos/internal/operator/orbiter/kinds/clusters/core/infra" 5 "github.com/caos/orbos/internal/operator/orbiter/kinds/providers/core" 6 "github.com/caos/orbos/pkg/tree" 7 ) 8 9 var _ infra.ProviderCurrent = (*Current)(nil) 10 11 type Current struct { 12 Common *tree.Common `yaml:",inline"` 13 Current struct { 14 pools map[string]infra.Pool `yaml:"-"` 15 Ingresses map[string]*infra.Address 16 cleanupped <-chan error `yaml:"-"` 17 privateInterface string `yaml:"-"` 18 } 19 } 20 21 func (c *Current) Pools() map[string]infra.Pool { 22 return c.Current.pools 23 } 24 func (c *Current) Ingresses() map[string]*infra.Address { 25 return c.Current.Ingresses 26 } 27 func (c *Current) Cleanupped() <-chan error { 28 return c.Current.cleanupped 29 } 30 func (c *Current) PrivateInterface() string { 31 return c.Current.privateInterface 32 } 33 34 func (c *Current) Kubernetes() infra.Kubernetes { 35 return infra.Kubernetes{} 36 } 37 38 func addPools(current *Current, desired *DesiredV0, machinesSvc core.MachinesService) error { 39 current.Current.pools = make(map[string]infra.Pool) 40 for pool := range desired.Spec.Pools { 41 current.Current.pools[pool] = newInfraPool(pool, machinesSvc) 42 } 43 44 unconfiguredPools, err := machinesSvc.ListPools() 45 if err != nil { 46 return nil 47 } 48 for _, unconfiguredPool := range unconfiguredPools { 49 if _, ok := current.Current.pools[unconfiguredPool]; !ok { 50 current.Current.pools[unconfiguredPool] = newInfraPool(unconfiguredPool, machinesSvc) 51 } 52 } 53 return nil 54 }