github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/orbiter/kinds/providers/static/pool.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  )
     7  
     8  var _ infra.Pool = (*infraPool)(nil)
     9  
    10  type infraPool struct {
    11  	pool        string
    12  	machinesSvc core.MachinesService
    13  }
    14  
    15  func newInfraPool(pool string, machinesSvc core.MachinesService) *infraPool {
    16  	return &infraPool{
    17  		pool:        pool,
    18  		machinesSvc: machinesSvc,
    19  	}
    20  }
    21  
    22  func (i *infraPool) DesiredMembers(instances int) int {
    23  	return instances
    24  }
    25  
    26  func (i *infraPool) EnsureMember(infra.Machine) error {
    27  	// Keepalived health checks should work
    28  	return nil
    29  }
    30  
    31  func (i *infraPool) EnsureMembers() error {
    32  	// Keepalived health checks should work
    33  	return nil
    34  }
    35  
    36  func (i *infraPool) GetMachines() (infra.Machines, error) {
    37  	return i.machinesSvc.List(i.pool)
    38  }
    39  
    40  func (i *infraPool) AddMachine(desiredInstances int) (infra.Machines, error) {
    41  	return i.machinesSvc.Create(i.pool, desiredInstances)
    42  }