Documentation ¶
Index ¶
- func ConfigureAvailabilityZone(managerConfig container.ManagerConfig, machineZone AvailabilityZoner) (container.ManagerConfig, error)
- func New(config Config) (environs.InstanceBroker, error)
- 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 AvailabilityZoner
- type Config
- type ContainerBrokerFunc
- type HostPreparer
- type HostPreparerParams
- type NetConfigFunc
- type NewBrokerFunc
- type PrepareAPI
- type PrepareHostFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureAvailabilityZone ¶
func ConfigureAvailabilityZone(managerConfig container.ManagerConfig, machineZone AvailabilityZoner) (container.ManagerConfig, error)
ConfigureAvailabilityZone reads the availability zone from the machine and adds the resulting information to the the manager config.
func New ¶
func New(config Config) (environs.InstanceBroker, error)
New creates a new InstanceBroker from the Config
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) (corenetwork.InterfaceInfos, 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 AvailabilityZoner ¶
type Config ¶
type Config struct { Name string ContainerType instance.ContainerType ManagerConfig container.ManagerConfig APICaller APICalls AgentConfig agent.Config MachineTag names.MachineTag MachineLock machinelock.Lock GetNetConfig NetConfigFunc }
Config describes the resources used by the instance broker.
type ContainerBrokerFunc ¶
type ContainerBrokerFunc func(PrepareHostFunc, APICalls, container.Manager, agent.Config) (environs.InstanceBroker, error)
ContainerBrokerFunc is used to align the constructors of the various brokers so that we can create them with the same arguments.
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 NetConfigFunc ¶
type NetConfigFunc func(corenetwork.ConfigSource) (corenetwork.InterfaceInfos, error)
NetConfigFunc returns a slice of NetworkConfig from a source config.
type NewBrokerFunc ¶
type NewBrokerFunc func(Config) (environs.InstanceBroker, error)
NewBrokerFunc returns a Instance Broker.
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.