provisioner

package
v0.0.0-...-7db8050 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: AGPL-3.0 Imports: 49 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerProvisioningManifold

func ContainerProvisioningManifold(config ContainerManifoldConfig) dependency.Manifold

ContainerProvisioningManifold creates a manifold that runs a container provisioner.

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold creates a manifold that runs an environment provisioner. See the ManifoldConfig type for discussion about how this can/should evolve.

func NewContainerSetupAndProvisioner

func NewContainerSetupAndProvisioner(cs *ContainerSetup, getContainerWatcherFunc GetContainerWatcherFunc) (worker.Worker, error)

NewContainerSetupAndProvisioner returns a ContainerSetupAndProvisioner.

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
	InstanceId() (instance.Id, error)
	EnsureDead() error
	Status() (status.Status, string, error)
	InstanceStatus() (status.Status, string, error)
	Id() string
}

type ContainerMachine

type ContainerMachine interface {
	AvailabilityZone() (string, error)
	Life() life.Value
	SupportedContainers() ([]instance.ContainerType, bool, error)
	WatchContainers(ctype instance.ContainerType) (watcher.StringsWatcher, error)
}

type ContainerMachineGetter

type ContainerMachineGetter interface {
	Machines(tags ...names.MachineTag) ([]ContainerMachineResult, error)
}

type ContainerMachineResult

type ContainerMachineResult struct {
	Machine ContainerMachine
	Err     error
}

type ContainerManagerConfigGetter

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

type ContainerManifoldConfig

type ContainerManifoldConfig struct {
	AgentName                    string
	APICallerName                string
	Logger                       Logger
	MachineLock                  machinelock.Lock
	NewCredentialValidatorFacade func(base.APICaller) (workercommon.CredentialAPI, error)
	ContainerType                instance.ContainerType
}

ContainerManifoldConfig defines a container provisioner's dependencies, including how to initialise the container system.

func (ContainerManifoldConfig) Validate

func (cfg ContainerManifoldConfig) Validate() error

Validate is called by start to check for bad configuration.

type ContainerSetup

type ContainerSetup struct {
	// contains filtered or unexported fields
}

ContainerSetup sets up the machine to be able to create containers and start a suitable provisioner. Work is triggered by the ContainerSetupAndProvisioner.

func NewContainerSetup

func NewContainerSetup(params ContainerSetupParams) *ContainerSetup

NewContainerSetup returns a ContainerSetup to start the container provisioner workers.

type ContainerSetupAndProvisioner

type ContainerSetupAndProvisioner struct {
	// contains filtered or unexported fields
}

ContainerSetupAndProvisioner is a worker that waits for a container of type defined in its config to be found for deployment. Then initializes the container system and starts a container provisioner of that type.

func (*ContainerSetupAndProvisioner) Kill

func (w *ContainerSetupAndProvisioner) Kill()

Kill is part of the worker.Worker interface.

func (*ContainerSetupAndProvisioner) Report

func (w *ContainerSetupAndProvisioner) Report() map[string]interface{}

Report provides information for the engine report.

func (*ContainerSetupAndProvisioner) Wait

Wait is part of the worker.Worker interface.

type ContainerSetupParams

type ContainerSetupParams struct {
	Logger        Logger
	ContainerType instance.ContainerType
	MTag          names.MachineTag
	MachineZone   broker.AvailabilityZoner
	Provisioner   *apiprovisioner.State
	Config        agent.Config
	MachineLock   machinelock.Lock
	CredentialAPI workercommon.CredentialAPI
	GetNetConfig  func(network.ConfigSource) (network.InterfaceInfos, error)
}

ContainerSetupParams are used to initialise a container setup worker.

type DistributionGroupFinder

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

type GetContainerWatcherFunc

type GetContainerWatcherFunc func() (watcher.StringsWatcher, error)

type LXDProfileInstanceBroker

type LXDProfileInstanceBroker interface {
	environs.InstanceBroker
	environs.LXDProfiler
}

This is needed to test provisioner.processProfileChanges

type Logger

type Logger interface {
	Tracef(string, ...interface{})
	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Warningf(string, ...interface{})
	Errorf(string, ...interface{})
}

Logger defines the logging methods that the worker uses.

type MachineClassification

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

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string
	EnvironName   string
	Logger        Logger

	NewProvisionerFunc           func(*apiprovisioner.State, agent.Config, Logger, environs.Environ, common.CredentialAPI) (Provisioner, error)
	NewCredentialValidatorFacade func(base.APICaller) (common.CredentialAPI, error)
}

ManifoldConfig defines an environment provisioner's dependencies. It's not currently clear whether it'll be easier to extend this type to include all provisioners, or to create separate (Environ|Container)Manifold[Config]s; for now we dodge the question because we don't need container provisioners in dependency engines. Yet.

type Provisioner

type Provisioner interface {
	worker.Worker
	// contains filtered or unexported methods
}

Provisioner represents a running provisioner worker.

func NewContainerProvisioner

func NewContainerProvisioner(
	containerType instance.ContainerType,
	st *apiprovisioner.State,
	logger Logger,
	agentConfig agent.Config,
	broker environs.InstanceBroker,
	toolsFinder ToolsFinder,
	distributionGroupFinder DistributionGroupFinder,
	credentialAPI common.CredentialAPI,
) (Provisioner, error)

NewContainerProvisioner returns a new Provisioner. When new machines are added to the state, it allocates instances from the environment and allocates them to the new machines.

func NewEnvironProvisioner

func NewEnvironProvisioner(
	st *apiprovisioner.State,
	agentConfig agent.Config,
	logger Logger,
	environ environs.Environ,
	credentialAPI common.CredentialAPI,
) (Provisioner, error)

NewEnvironProvisioner returns a new Provisioner for an environment. When new machines are added to the state, it allocates instances from the environment and allocates them to the new machines.

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 {
	// contains filtered or unexported fields
}

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

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

func NewRetryStrategy

func NewRetryStrategy(delay time.Duration, count int) RetryStrategy

NewRetryStrategy returns a new retry strategy with the specified delay and count for use with retryable provisioning errors.

type TaskAPI

type TaskAPI interface {
	Machines(...names.MachineTag) ([]apiprovisioner.MachineResult, error)
	MachinesWithTransientErrors() ([]apiprovisioner.MachineStatusResult, error)
	ProvisioningInfo(machineTags []names.MachineTag) (params.ProvisioningInfoResults, error)
}

TaskAPI describes API methods required by a ProvisionerTask.

type TaskConfig

type TaskConfig struct {
	ControllerUUID             string
	HostTag                    names.Tag
	Logger                     Logger
	HarvestMode                config.HarvestMode
	TaskAPI                    TaskAPI
	DistributionGroupFinder    DistributionGroupFinder
	ToolsFinder                ToolsFinder
	MachineWatcher             watcher.StringsWatcher
	RetryWatcher               watcher.NotifyWatcher
	Broker                     environs.InstanceBroker
	Auth                       authentication.AuthenticationProvider
	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(version version.Number, os string, arch string) (coretools.List, error)
}

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

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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