provisioner

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewLxdBroker = func(
	api APICalls,
	manager container.Manager,
	agentConfig agent.Config,
) (environs.InstanceBroker, error) {
	return &lxdBroker{
		manager:     manager,
		api:         api,
		agentConfig: agentConfig,
	}, nil
}
View Source
var StartProvisioner = startProvisionerWorker

Override for testing.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

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

func NewContainerSetupHandler

func NewContainerSetupHandler(params ContainerSetupParams) watcher.StringsHandler

NewContainerSetupHandler returns a StringsWatchHandler which is notified when containers are created on the given machine.

func NewKvmBroker

func NewKvmBroker(
	api APICalls,
	agentConfig agent.Config,
	managerConfig container.ManagerConfig,
) (environs.InstanceBroker, error)

Types

type APICalls

type APICalls interface {
	ContainerConfig() (params.ContainerConfig, error)
	PrepareContainerInterfaceInfo(names.MachineTag) ([]network.InterfaceInfo, error)
	GetContainerInterfaceInfo(names.MachineTag) ([]network.InterfaceInfo, error)
	ReleaseContainerAddresses(names.MachineTag) error
}

type ClassifiableMachine

type ClassifiableMachine interface {
	Life() params.Life
	InstanceId() (instance.Id, error)
	EnsureDead() error
	Status() (status.Status, string, error)
	Id() string
}

type ContainerSetup

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

ContainerSetup is a StringsWatchHandler that is notified when containers are created on the given machine. It will set up the machine to be able to create containers and start a suitable provisioner.

func (*ContainerSetup) Handle

func (cs *ContainerSetup) Handle(abort <-chan struct{}, containerIds []string) (resultError error)

Handle is called whenever containers change on the machine being watched. Machines start out with no containers so the first time Handle is called, it will be because a container has been added.

func (*ContainerSetup) SetUp

func (cs *ContainerSetup) SetUp() (watcher watcher.StringsWatcher, err error)

SetUp is defined on the StringsWatchHandler interface.

func (*ContainerSetup) TearDown

func (cs *ContainerSetup) TearDown() error

TearDown is defined on the StringsWatchHandler interface.

type ContainerSetupParams

type ContainerSetupParams struct {
	Runner              worker.Runner
	WorkerName          string
	SupportedContainers []instance.ContainerType
	Machine             *apiprovisioner.Machine
	Provisioner         *apiprovisioner.State
	Config              agent.Config
	InitLockName        string
}

ContainerSetupParams are used to initialise a container setup handler.

type MachineClassification

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

type MachineGetter

type MachineGetter interface {
	Machine(names.MachineTag) (*apiprovisioner.Machine, error)
	MachinesWithTransientErrors() ([]*apiprovisioner.Machine, []params.StatusResult, error)
}

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string
	EnvironName   string

	NewProvisionerFunc func(*apiprovisioner.State, agent.Config, environs.Environ) (Provisioner, 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,
	agentConfig agent.Config,
	broker environs.InstanceBroker,
	toolsFinder ToolsFinder,
) (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, environ environs.Environ) (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)
}

func NewProvisionerTask

func NewProvisionerTask(
	controllerUUID string,
	machineTag names.MachineTag,
	harvestMode config.HarvestMode,
	machineGetter MachineGetter,
	toolsFinder ToolsFinder,
	machineWatcher watcher.StringsWatcher,
	retryWatcher watcher.NotifyWatcher,
	broker environs.InstanceBroker,
	auth authentication.AuthenticationProvider,
	imageStream string,
	retryStartInstanceStrategy RetryStrategy,
) (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 ToolsFinder

type ToolsFinder interface {
	// FindTools returns a list of tools matching the specified
	// version, series, and architecture. If arch is empty, the
	// implementation is expected to use a well documented default.
	FindTools(version version.Number, series 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