juju: github.com/juju/juju/worker/provisioner Index | Files | Directories

package provisioner

import "github.com/juju/juju/worker/provisioner"

Index

Package Files

container_initialisation.go logging.go manifold.go provisioner.go provisioner_task.go shim.go

Variables

var StartProvisioner = startProvisionerWorker

Override for testing.

func Manifold Uses

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 Uses

func NewContainerSetupHandler(params ContainerSetupParams) watcher.StringsHandler

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

type AvailabilityZoneMachine Uses

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 Uses

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

type ContainerSetup Uses

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 Uses

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 Uses

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

SetUp is defined on the StringsWatchHandler interface.

func (*ContainerSetup) TearDown Uses

func (cs *ContainerSetup) TearDown() error

TearDown is defined on the StringsWatchHandler interface. NoOp here.

type ContainerSetupParams Uses

type ContainerSetupParams struct {
    Runner              *worker.Runner
    Logger              Logger
    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 Uses

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

type LXDProfileInstanceBroker Uses

type LXDProfileInstanceBroker interface {
    environs.InstanceBroker
    environs.LXDProfiler
}

This is needed to test provisioner.processProfileChanges

go:generate mockgen -package mocks -destination mocks/lxdprofileinstancebroker_mock.go github.com/juju/juju/worker/provisioner LXDProfileInstanceBroker

type Logger Uses

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 Uses

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

type MachineGetter Uses

type MachineGetter interface {
    Machines(...names.MachineTag) ([]apiprovisioner.MachineResult, error)
    MachinesWithTransientErrors() ([]apiprovisioner.MachineStatusResult, error)
}

type ManifoldConfig Uses

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 Uses

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

Provisioner represents a running provisioner worker.

func NewContainerProvisioner Uses

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 Uses

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 Uses

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 Uses

func NewProvisionerTask(
    controllerUUID string,
    machineTag names.MachineTag,
    logger Logger,
    harvestMode config.HarvestMode,
    machineGetter MachineGetter,
    distributionGroupFinder DistributionGroupFinder,
    toolsFinder ToolsFinder,
    machineWatcher watcher.StringsWatcher,
    retryWatcher watcher.NotifyWatcher,
    broker environs.InstanceBroker,
    auth authentication.AuthenticationProvider,
    imageStream string,
    retryStartInstanceStrategy RetryStrategy,
    cloudCallContext context.ProviderCallContext,
) (ProvisionerTask, error)

type RetryStrategy Uses

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 Uses

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 Uses

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.

Directories

PathSynopsis
mocksPackage mocks is a generated GoMock package.

Package provisioner imports 50 packages (graph) and is imported by 64 packages. Updated 2019-10-16. Refresh now. Tools for package owners.