provisionertask

package
v0.0.0-...-84dfa8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2025 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailabilityZoneMachine

type AvailabilityZoneMachine struct {
	ZoneName           string
	MachineIds         set.Strings
	FailedMachineIds   set.Strings
	ExcludedMachineIds set.Strings // Don't use these machines in the zone.
}

AvailabilityZoneMachine keeps track a single zone and which machines are in it, which machines have failed to use it and which machines shouldn't use it. This data is used to decide on how to distribute machines across availability zones.

Exposed for testing.

func (*AvailabilityZoneMachine) MatchesConstraints

func (az *AvailabilityZoneMachine) MatchesConstraints(cons constraints.Value) bool

MatchesConstraints against an AZ. If the constraints specifies Zones, make sure this AZ matches a listed ZoneName.

type ClassifiableMachine

type ClassifiableMachine interface {
	Life() life.Value
	Id() string
	InstanceId(context.Context) (instance.Id, error)
	EnsureDead(context.Context) error
	Status(context.Context) (status.Status, string, error)
	InstanceStatus(context.Context) (status.Status, string, error)
}

type ContainerManagerConfigGetter

type ContainerManagerConfigGetter interface {
	ContainerManagerConfig(context.Context, params.ContainerManagerConfigParams) (params.ContainerManagerConfig, error)
}

ContainerManagerConfigGetter describes methods for retrieving model config needed for configuring the container manager.

type ControllerAPI

type ControllerAPI interface {
	ControllerConfig(context.Context) (controller.Config, error)
	CACert(context.Context) (string, error)
	ModelUUID(context.Context) (string, error)
	ModelConfig(context.Context) (*config.Config, error)
	WatchForModelConfigChanges(context.Context) (watcher.NotifyWatcher, error)
	APIAddresses(context.Context) ([]string, error)
}

ControllerAPI describes API methods for querying a controller.

type DistributionGroupFinder

type DistributionGroupFinder interface {
	DistributionGroupByMachineId(context.Context, ...names.MachineTag) ([]apiprovisioner.DistributionGroupResult, error)
}

DistributionGroupFinder provides access to machine distribution groups.

type GetMachineInstanceInfoSetter

type GetMachineInstanceInfoSetter func(machineProvisioner apiprovisioner.MachineProvisioner) func(
	ctx context.Context,
	id instance.Id, displayName string, nonce string, characteristics *instance.HardwareCharacteristics,
	networkConfig []params.NetworkConfig, volumes []params.Volume,
	volumeAttachments map[string]params.VolumeAttachmentInfo, charmProfiles []string,
) error

GetMachineInstanceInfoSetter provides the interface for setting the instance info of a machine. It takes a machine provisioner API as input so it can be used when we don't have a machine service available.

type MachineClassification

type MachineClassification string
const (
	None    MachineClassification = "none"
	Pending MachineClassification = "Pending"
	Dead    MachineClassification = "Dead"
)

type MachinesAPI

type MachinesAPI interface {
	Machines(context.Context, ...names.MachineTag) ([]apiprovisioner.MachineResult, error)
	MachinesWithTransientErrors(context.Context) ([]apiprovisioner.MachineStatusResult, error)
	WatchMachineErrorRetry(context.Context) (watcher.NotifyWatcher, error)
	WatchModelMachines(context.Context) (watcher.StringsWatcher, error)
	ProvisioningInfo(_ context.Context, machineTags []names.MachineTag) (params.ProvisioningInfoResults, error)
}

MachinesAPI describes API methods required to access machine provisioning info.

type ProvisionerTask

type ProvisionerTask interface {
	worker.Worker

	// SetHarvestMode sets a flag to indicate how the provisioner task
	// should harvest machines. See config.HarvestMode for
	// documentation of behavior.
	SetHarvestMode(mode config.HarvestMode)

	// SetNumProvisionWorkers resizes the pool of provision workers.
	SetNumProvisionWorkers(numWorkers int)
}

func NewProvisionerTask

func NewProvisionerTask(cfg TaskConfig) (ProvisionerTask, error)

type RetryStrategy

type RetryStrategy struct {
	RetryDelay time.Duration
	RetryCount int
}

RetryStrategy defines the retry behavior when encountering a retryable error during provisioning.

TODO(katco): 2016-08-09: lp:1611427

type TaskConfig

type TaskConfig struct {
	ControllerUUID               string
	HostTag                      names.Tag
	Logger                       logger.Logger
	HarvestMode                  config.HarvestMode
	ControllerAPI                ControllerAPI
	MachinesAPI                  MachinesAPI
	GetMachineInstanceInfoSetter GetMachineInstanceInfoSetter
	DistributionGroupFinder      DistributionGroupFinder
	ToolsFinder                  ToolsFinder
	MachineWatcher               watcher.StringsWatcher
	RetryWatcher                 watcher.NotifyWatcher
	Broker                       environs.InstanceBroker
	ImageStream                  string
	RetryStartInstanceStrategy   RetryStrategy
	CloudCallContextFunc         common.CloudCallContextFunc
	NumProvisionWorkers          int
	EventProcessedCb             func(string)
}

TaskConfig holds the initialisation data for a ProvisionerTask instance.

type ToolsFinder

type ToolsFinder interface {
	// FindTools returns a list of tools matching the specified
	// version, os, and architecture. If arch is empty, the
	// implementation is expected to use a well documented default.
	FindTools(ctx context.Context, version version.Number, os string, arch string) (coretools.List, error)
}

ToolsFinder is an interface used for finding tools to run on provisioned instances.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL