provisioner

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 45 Imported by: 2

Documentation

Overview

Package provisioner supplies the API facade used by the provisioner worker.

Versions of the API < 10 have logic dating from the original spaces implementation. If multiple positive space constraints are supplied, only the first in the list is used to determine possible subnet/AZ combinations suitable for machine location.

Version 10+ will consider all supplied positive space constraints when making this determination.

Index

Constants

This section is empty.

Variables

View Source
var ErrorRetryWaitDelay = 1 * time.Minute

ErrorRetryWaitDelay is the poll time currently used to trigger the watcher.

Functions

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type Application

type Application interface {
	Charm() (Charm, bool, error)
	Name() string
}

Application is an indirection for state.Application.

type BridgePolicy

type BridgePolicy interface {
	// FindMissingBridgesForContainer looks at the spaces that the container should
	// have access to, and returns any host devices need to be bridged for use as
	// the container network.
	FindMissingBridgesForContainer(containerizer.Machine, containerizer.Container) ([]network.DeviceToBridge, int, error)

	// PopulateContainerLinkLayerDevices sets the link-layer devices of the input
	// guest, setting each device to be a child of the corresponding bridge on the
	// host machine.
	PopulateContainerLinkLayerDevices(
		containerizer.Machine, containerizer.Container, bool,
	) (corenetwork.InterfaceInfos, error)
}

BridgePolicy is an indirection for containerizer.BridgePolicy.

type Charm

type Charm interface {
	LXDProfile() *jujucharm.LXDProfile
	Revision() int
}

Charm is an indirection for state.Charm.

type Machine

type Machine interface {
	containerizer.Container

	Units() ([]Unit, error)
	InstanceId() (instance.Id, error)
	IsManual() (bool, error)
	MachineTag() names.MachineTag
}

Machine is an indirection for use in container provisioning. It is an indirection for both containerizer.Machine and containerizer.Container as well as state.Machine locally.

type MachineShim

type MachineShim struct {
	*state.Machine
}

MachineShim implements Machine. It is required for use of the containerizer and to mock container creation tests here.

func NewMachine

func NewMachine(m *state.Machine) *MachineShim

NewMachine wraps the given state.machine in a MachineShim.

func (*MachineShim) AllDeviceAddresses

func (m *MachineShim) AllDeviceAddresses() ([]containerizer.Address, error)

AllDeviceAddresses implements Machine by wrapping each state.Address reference in returned collection with the containerizer Address implementation.

func (*MachineShim) AllLinkLayerDevices

func (m *MachineShim) AllLinkLayerDevices() ([]containerizer.LinkLayerDevice, error)

AllLinkLayerDevices implements Machine by wrapping each state.LinkLayerDevice reference in returned collection with the containerizer LinkLayerDevice implementation.

func (*MachineShim) Raw

func (m *MachineShim) Raw() *state.Machine

Raw returns the inner state.Machine reference.

func (*MachineShim) Units

func (m *MachineShim) Units() ([]Unit, error)

Units implements Machine by wrapping each state.Unit reference in returned collection with the Unit implementation.

type ProvisionerAPI

ProvisionerAPI provides access to the Provisioner API facade.

func NewProvisionerAPI

func NewProvisionerAPI(ctx facade.Context) (*ProvisionerAPI, error)

NewProvisionerAPI creates a new server-side ProvisionerAPI facade.

func (*ProvisionerAPI) AvailabilityZone

func (api *ProvisionerAPI) AvailabilityZone(args params.Entities) (params.StringResults, error)

AvailabilityZone returns a provider-specific availability zone for each given machine entity

func (*ProvisionerAPI) CACert

func (api *ProvisionerAPI) CACert() (params.BytesResult, error)

CACert returns the certificate used to validate the state connection.

func (*ProvisionerAPI) Constraints

func (api *ProvisionerAPI) Constraints(args params.Entities) (params.ConstraintsResults, error)

Constraints returns the constraints for each given machine entity.

func (*ProvisionerAPI) ContainerConfig

func (api *ProvisionerAPI) ContainerConfig() (params.ContainerConfig, error)

ContainerConfig returns information from the model config that is needed for container cloud-init.

func (*ProvisionerAPI) ContainerManagerConfig

ContainerManagerConfig returns information from the model config that is needed for configuring the container manager.

func (*ProvisionerAPI) DistributionGroup

func (api *ProvisionerAPI) DistributionGroup(args params.Entities) (params.DistributionGroupResults, error)

DistributionGroup returns, for each given machine entity, a slice of instance.Ids that belong to the same distribution group as that machine. This information may be used to distribute instances for high availability.

func (*ProvisionerAPI) DistributionGroupByMachineId

func (api *ProvisionerAPI) DistributionGroupByMachineId(args params.Entities) (params.StringsResults, error)

DistributionGroupByMachineId returns, for each given machine entity, a slice of machine.Ids that belong to the same distribution group as that machine. This information may be used to distribute instances for high availability.

func (*ProvisionerAPI) FindTools

FindTools returns a List containing all tools matching the given parameters.

func (*ProvisionerAPI) GetContainerInterfaceInfo

func (api *ProvisionerAPI) GetContainerInterfaceInfo(args params.Entities) (
	params.MachineNetworkConfigResults,
	error,
)

GetContainerInterfaceInfo returns information to configure networking for a container. It accepts container tags as arguments.

func (*ProvisionerAPI) GetContainerProfileInfo

func (api *ProvisionerAPI) GetContainerProfileInfo(args params.Entities) (params.ContainerProfileResults, error)

GetContainerProfileInfo returns information to configure a lxd profile(s) for a container based on the charms deployed to the container. It accepts container tags as arguments. Unlike machineLXDProfileNames which has the environ write the lxd profiles and returns the names of profiles already written.

func (*ProvisionerAPI) HostChangesForContainers

func (api *ProvisionerAPI) HostChangesForContainers(args params.Entities) (params.HostNetworkChangeResults, error)

HostChangesForContainers returns the set of changes that need to be done to the host machine to prepare it for the containers to be created. Pass in a list of the containers that you want the changes for.

func (*ProvisionerAPI) InstanceStatus

func (api *ProvisionerAPI) InstanceStatus(args params.Entities) (params.StatusResults, error)

InstanceStatus returns the instance status for each given entity. Only machine tags are accepted.

func (*ProvisionerAPI) KeepInstance

func (api *ProvisionerAPI) KeepInstance(args params.Entities) (params.BoolResults, error)

KeepInstance returns the keep-instance value for each given machine entity.

func (*ProvisionerAPI) MachinesWithTransientErrors

func (api *ProvisionerAPI) MachinesWithTransientErrors() (params.StatusResults, error)

MachinesWithTransientErrors returns status data for machines with provisioning errors which are transient.

func (*ProvisionerAPI) MarkMachinesForRemoval

func (api *ProvisionerAPI) MarkMachinesForRemoval(machines params.Entities) (params.ErrorResults, error)

MarkMachinesForRemoval indicates that the specified machines are ready to have any provider-level resources cleaned up and then be removed.

func (*ProvisionerAPI) ModelUUID

func (api *ProvisionerAPI) ModelUUID() params.StringResult

ModelUUID returns the model UUID that the current connection is for.

func (*ProvisionerAPI) PrepareContainerInterfaceInfo

func (api *ProvisionerAPI) PrepareContainerInterfaceInfo(args params.Entities) (
	params.MachineNetworkConfigResults,
	error,
)

PrepareContainerInterfaceInfo allocates an address and returns information to configure networking for a container. It accepts container tags as arguments.

func (*ProvisionerAPI) ProvisioningInfo

func (api *ProvisionerAPI) ProvisioningInfo(args params.Entities) (params.ProvisioningInfoResults, error)

ProvisioningInfo returns the provisioning information for each given machine entity. It supports all positive space constraints.

func (*ProvisionerAPI) ReleaseContainerAddresses

func (api *ProvisionerAPI) ReleaseContainerAddresses(args params.Entities) (params.ErrorResults, error)

ReleaseContainerAddresses finds addresses allocated to a container and marks them as Dead, to be released and removed. It accepts container tags as arguments.

func (*ProvisionerAPI) SetCharmProfiles

func (api *ProvisionerAPI) SetCharmProfiles(args params.SetProfileArgs) (params.ErrorResults, error)

SetCharmProfiles records the given slice of charm profile names.

func (*ProvisionerAPI) SetHostMachineNetworkConfig

func (api *ProvisionerAPI) SetHostMachineNetworkConfig(args params.SetMachineNetworkConfig) error

func (*ProvisionerAPI) SetInstanceInfo

func (api *ProvisionerAPI) SetInstanceInfo(args params.InstancesInfo) (params.ErrorResults, error)

SetInstanceInfo sets the provider specific machine id, nonce, metadata and network info for each given machine. Once set, the instance id cannot be changed.

func (*ProvisionerAPI) SetInstanceStatus

func (api *ProvisionerAPI) SetInstanceStatus(args params.SetStatus) (params.ErrorResults, error)

SetInstanceStatus updates the instance status for each given entity. Only machine tags are accepted.

func (*ProvisionerAPI) SetModificationStatus

func (api *ProvisionerAPI) SetModificationStatus(args params.SetStatus) (params.ErrorResults, error)

SetModificationStatus updates the instance whilst changes are occurring. This is different from SetStatus and SetInstanceStatus, by the fact this holds information about the ongoing changes that are happening to instances. Consider LXD Profile updates that can modify a instance, but may not cause the instance to be placed into a error state. This modification status serves the purpose of highlighting that to the operator. Only machine tags are accepted.

func (*ProvisionerAPI) SetSupportedContainers

func (api *ProvisionerAPI) SetSupportedContainers(args params.MachineContainersParams) (params.ErrorResults, error)

SetSupportedContainers updates the list of containers supported by the machines passed in args.

func (*ProvisionerAPI) SupportedContainers

func (api *ProvisionerAPI) SupportedContainers(args params.Entities) (params.MachineContainerResults, error)

SupportedContainers returns the list of containers supported by the machines passed in args.

func (*ProvisionerAPI) WatchAllContainers

func (api *ProvisionerAPI) WatchAllContainers(args params.WatchContainers) (params.StringsWatchResults, error)

WatchAllContainers starts a StringsWatcher to watch all containers deployed to any machine passed in args.

func (*ProvisionerAPI) WatchContainers

func (api *ProvisionerAPI) WatchContainers(args params.WatchContainers) (params.StringsWatchResults, error)

WatchContainers starts a StringsWatcher to watch containers deployed to any machine passed in args.

func (*ProvisionerAPI) WatchMachineErrorRetry

func (api *ProvisionerAPI) WatchMachineErrorRetry() (params.NotifyWatchResult, error)

WatchMachineErrorRetry returns a NotifyWatcher that notifies when the provisioner should retry provisioning machines with transient errors.

type ProvisionerAPIV11

type ProvisionerAPIV11 struct {
	*ProvisionerAPI
}

ProvisionerAPIV11 provides v10 of the provisioner facade. It relies on agent-set origin when calling SetHostMachineNetworkConfig.

type Unit

type Unit interface {
	Application() (Application, error)
	Name() string
}

Unit is an indirection for state.Unit.

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