juju: github.com/wallyworld/juju/worker/containerbroker Index | Files | Directories

package containerbroker

import "github.com/wallyworld/juju/worker/containerbroker"

Copyright 2019 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details.

Copyright 2019 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details. Package containerbroker worker sole responsibility is to manage the lifecycle of a instance-broker. Configuration of the instance-broker relies on talking to the provisioner to ensure that we correctly configure the correct availability zones. Failure to do so, will result in an error.

The instance-broker is created for LXD types only and any other container types cause the worker to uninstall itself.

Copyright 2019 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details.


Package Files

broker.go doc.go manifold.go

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a Manifold that encapsulates a *Tracker and exposes it as an Broker resource.

func NewWorkerTracker Uses

func NewWorkerTracker(config Config) (worker.Worker, error)

NewWorkerTracker defines a function that is covariant in the return type so that the manifold can use the covariance of the function as an alias.

type Config Uses

type Config struct {
    APICaller     base.APICaller
    AgentConfig   agent.Config
    MachineLock   machinelock.Lock
    NewBrokerFunc func(broker.Config) (environs.InstanceBroker, error)
    NewStateFunc  func(base.APICaller) State

Config describes the dependencies of a Tracker.

It's arguable that it should be called TrackerConfig, because of the heavy use of model config in this package.

func (Config) Validate Uses

func (config Config) Validate() error

Validate returns an error if the config cannot be used to start a Tracker.

type ManifoldConfig Uses

type ManifoldConfig struct {
    AgentName     string
    APICallerName string
    MachineLock   machinelock.Lock
    NewBrokerFunc func(broker.Config) (environs.InstanceBroker, error)
    NewTracker    func(Config) (worker.Worker, error)

ManifoldConfig describes the resources used by a Tracker.

func (ManifoldConfig) Validate Uses

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type State Uses

type State interface {
    Machines(...names.MachineTag) ([]provisioner.MachineResult, error)
    ContainerManagerConfig(params.ContainerManagerConfigParams) (params.ContainerManagerConfig, error)

State represents the interaction for the apiserver

type Tracker Uses

type Tracker struct {
    // contains filtered or unexported fields

Tracker loads a broker, makes it available to clients, and updates the broker in response to config changes until it is killed.

func NewTracker Uses

func NewTracker(config Config) (*Tracker, error)

NewTracker returns a new Tracker, or an error if anything goes wrong. If a tracker is returned, its Broker() method is immediately usable.

The caller is responsible for Kill()ing the returned Tracker and Wait()ing for any errors it might return.

func (*Tracker) Broker Uses

func (t *Tracker) Broker() environs.InstanceBroker

Broker returns the encapsulated Broker. It will continue to be updated in the background for as long as the Tracker continues to run.

func (*Tracker) Kill Uses

func (t *Tracker) Kill()

Kill is part of the worker.Worker interface.

func (*Tracker) Wait Uses

func (t *Tracker) Wait() error

Wait is part of the worker.Worker interface.


mocksPackage mocks is a generated GoMock package.

Package containerbroker imports 16 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.