Documentation ¶
Index ¶
- Variables
- func Manifold(config ManifoldConfig) dependency.Manifold
- func NewContainerSetupHandler(params ContainerSetupParams) watcher.StringsHandler
- func NewKVMBroker(prepareHost PrepareHostFunc, api APICalls, manager container.Manager, ...) (environs.InstanceBroker, error)
- func NewLXDBroker(prepareHost PrepareHostFunc, api APICalls, manager container.Manager, ...) (environs.InstanceBroker, error)
- type APICalls
- type AvailabilityZoneMachine
- type ClassifiableMachine
- type ContainerSetup
- type ContainerSetupParams
- type DistributionGroupFinder
- type HostPreparer
- type HostPreparerParams
- type LXDProfileInstanceBroker
- type MachineClassification
- type MachineGetter
- type ManifoldConfig
- type PrepareAPI
- type PrepareHostFunc
- type Provisioner
- type ProvisionerTask
- type RetryStrategy
- type ToolsFinder
Constants ¶
This section is empty.
Variables ¶
var GetMachineCloudInitData = cloudconfig.GetMachineCloudInitData
GetMachineCloudInitData is for testing purposes.
var StartProvisioner = startProvisionerWorker
Override for testing.
Functions ¶
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 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( prepareHost PrepareHostFunc, api APICalls, manager container.Manager, agentConfig agent.Config, ) (environs.InstanceBroker, error)
NewKVMBroker creates a Broker that can be used to start KVM guests in a similar fashion to normal StartInstance requests. prepareHost is a callback that will be called when a new container is about to be started. It provides the intersection point where the host can update itself to be ready for whatever changes are necessary to have a functioning container. (such as bridging host devices.) manager is the infrastructure to actually launch the container. agentConfig is currently only used to find out the 'default' bridge to use when a specific network device is not specified in StartInstanceParams. This should be deprecated. And hopefully removed in the future.
func NewLXDBroker ¶
func NewLXDBroker( prepareHost PrepareHostFunc, api APICalls, manager container.Manager, agentConfig agent.Config, ) (environs.InstanceBroker, error)
NewLXDBroker creates a Broker that can be used to start LXD containers in a similar fashion to normal StartInstance requests. prepareHost is a callback that will be called when a new container is about to be started. It provides the intersection point where the host can update itself to be ready for whatever changes are necessary to have a functioning container. (such as bridging host devices.) manager is the infrastructure to actually launch the container. agentConfig is currently only used to find out the 'default' bridge to use when a specific network device is not specified in StartInstanceParams. This should be deprecated. And hopefully removed in the future.
Types ¶
type APICalls ¶
type APICalls interface { ContainerConfig() (params.ContainerConfig, error) PrepareContainerInterfaceInfo(names.MachineTag) ([]network.InterfaceInfo, error) GetContainerInterfaceInfo(names.MachineTag) ([]network.InterfaceInfo, error) GetContainerProfileInfo(names.MachineTag) ([]*apiprovisioner.LXDProfileResult, error) ReleaseContainerAddresses(names.MachineTag) error SetHostMachineNetworkConfig(names.MachineTag, []params.NetworkConfig) error HostChangesForContainer(containerTag names.MachineTag) ([]network.DeviceToBridge, int, error) }
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.
type ClassifiableMachine ¶
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. NoOp here.
type ContainerSetupParams ¶
type ContainerSetupParams struct { Runner *worker.Runner WorkerName string SupportedContainers []instance.ContainerType Machine apiprovisioner.MachineProvisioner Provisioner *apiprovisioner.State Config agent.Config MachineLock machinelock.Lock CredentialAPI workercommon.CredentialAPI }
ContainerSetupParams are used to initialise a container setup handler.
type DistributionGroupFinder ¶
type DistributionGroupFinder interface {
DistributionGroupByMachineId(...names.MachineTag) ([]apiprovisioner.DistributionGroupResult, error)
}
type HostPreparer ¶
type HostPreparer struct {
// contains filtered or unexported fields
}
HostPreparer calls out to the PrepareAPI to find out what changes need to be done on this host to allow a new container to be started.
func NewHostPreparer ¶
func NewHostPreparer(params HostPreparerParams) *HostPreparer
NewHostPreparer creates a HostPreparer using the supplied parameters
func (*HostPreparer) Prepare ¶
func (hp *HostPreparer) Prepare(containerTag names.MachineTag) error
Prepare applies changes to the host machine that are necessary to create the requested container.
type HostPreparerParams ¶
type HostPreparerParams struct { API PrepareAPI ObserveNetworkFunc func() ([]params.NetworkConfig, error) AcquireLockFunc func(string, <-chan struct{}) (func(), error) CreateBridger func() (network.Bridger, error) AbortChan <-chan struct{} MachineTag names.MachineTag Logger loggo.Logger }
HostPreparerParams is the configuration for HostPreparer
type LXDProfileInstanceBroker ¶
type LXDProfileInstanceBroker interface { environs.InstanceBroker environs.LXDProfiler }
This is needed to test provisioner.processProfileChanges
type MachineClassification ¶
type MachineClassification string
const ( None MachineClassification = "none" Pending MachineClassification = "Pending" Dead MachineClassification = "Dead" Maintain MachineClassification = "Maintain" )
type MachineGetter ¶
type MachineGetter interface { Machines(...names.MachineTag) ([]apiprovisioner.MachineResult, error) MachinesWithTransientErrors() ([]apiprovisioner.MachineStatusResult, error) }
type ManifoldConfig ¶
type ManifoldConfig struct { AgentName string APICallerName string EnvironName string NewProvisionerFunc func(*apiprovisioner.State, agent.Config, 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 PrepareAPI ¶
type PrepareAPI interface { // HostChangesForContainer returns the list of bridges to be created on the // host machine, and the time to sleep after creating the bridges before // bringing them up. HostChangesForContainer(names.MachineTag) ([]network.DeviceToBridge, int, error) // SetHostMachineNetworkConfig allows us to report back the host machine's // current networking config. This is called after we've created new // bridges to inform the Controller what the current networking interfaces // are. SetHostMachineNetworkConfig(names.MachineTag, []params.NetworkConfig) error }
PrepareAPI is the functional interface that we need to be able to ask what changes are necessary, and to then report back what changes have been done to the host machine.
type PrepareHostFunc ¶
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, 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, 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) }
func NewProvisionerTask ¶
func NewProvisionerTask( controllerUUID string, machineTag names.MachineTag, harvestMode config.HarvestMode, machineGetter MachineGetter, distributionGroupFinder DistributionGroupFinder, toolsFinder ToolsFinder, machineWatcher watcher.StringsWatcher, retryWatcher watcher.NotifyWatcher, profileWatcher watcher.StringsWatcher, broker environs.InstanceBroker, auth authentication.AuthenticationProvider, imageStream string, retryStartInstanceStrategy RetryStrategy, cloudCallContext context.ProviderCallContext, ) (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.