Documentation ¶
Index ¶
- type Provisioner
- func (p *Provisioner) CurrentSlotCount() (int, error)
- func (p *Provisioner) InstanceType() string
- func (p *Provisioner) LaunchError() error
- func (p *Provisioner) Provision()
- func (p *Provisioner) Run()
- func (p *Provisioner) SlotsPerInstance() int
- func (p *Provisioner) UpdateScalingInfo(info *sproto.ScalingInfo)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provisioner ¶
type Provisioner struct {
// contains filtered or unexported fields
}
Provisioner provisions and terminates agent instances. It is composed of four parts: a provisioner, a scaling decision maker, a provider, and a rate limiter.
- The provisioner is capable of reporting provider information and updating scaling info. 1.1. `Scheduler` pushes an immutable view of agents and tasks to `Provisioner`. `Provisioner` pulls instance data from instance providers.
- Based on the pending tasks, the scaleDecider chooses how many new instances to launch and which instances to terminate. 2.1 It terminates instances if they stay idle for more than `maxIdleAgentPeriod` time. 2.2 It checks recently launched instances and avoids provisioning more than needed.
- The instance providers take actions to launch/terminate instances.
- The rate limiter ensures telemetry does not get sent more frequently than every 90sec.
func New ¶
func New( resourcePool string, config *provconfig.Config, cert *tls.Certificate, db db.DB, ) (*Provisioner, error)
New creates a new Provisioner.
func Setup ¶
func Setup( config *provconfig.Config, resourcePool string, cert *tls.Certificate, db db.DB, ) (*Provisioner, error)
Setup initializes the provisioner.
func (*Provisioner) CurrentSlotCount ¶
func (p *Provisioner) CurrentSlotCount() (int, error)
CurrentSlotCount returns the number of Slots available in the cluster.
func (*Provisioner) InstanceType ¶
func (p *Provisioner) InstanceType() string
InstanceType returns the instance type of the provider for the provisioner.
func (*Provisioner) LaunchError ¶
func (p *Provisioner) LaunchError() error
LaunchError returns the current launch error sent from the provider.
func (*Provisioner) Provision ¶
func (p *Provisioner) Provision()
Provision runs a single provisioning iteration.
func (*Provisioner) SlotsPerInstance ¶
func (p *Provisioner) SlotsPerInstance() int
SlotsPerInstance returns the number of Slots per instance the provisioner launches.
func (*Provisioner) UpdateScalingInfo ¶
func (p *Provisioner) UpdateScalingInfo(info *sproto.ScalingInfo)
UpdateScalingInfo updates the scaling info for the provisioner.