juju: github.com/wallyworld/juju/worker/machineundertaker Index | Files

package machineundertaker

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


Package Files

manifold.go undertaker.go

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that runs a machine undertaker.

func NewWorker Uses

func NewWorker(api Facade, env environs.Environ, credentialAPI common.CredentialAPI, logger Logger) (worker.Worker, error)

NewWorker returns a machine undertaker worker that will watch for machines that need to be removed and remove them, cleaning up any necessary provider-level resources first.

type AddressReleaser Uses

type AddressReleaser interface {
    ReleaseContainerAddresses(context.ProviderCallContext, []network.ProviderInterfaceInfo) error

AddressReleaser defines the interface we need from the environment networking.

type Facade Uses

type Facade interface {
    WatchMachineRemovals() (watcher.NotifyWatcher, error)
    AllMachineRemovals() ([]names.MachineTag, error)
    GetProviderInterfaceInfo(names.MachineTag) ([]network.ProviderInterfaceInfo, error)
    CompleteRemoval(names.MachineTag) error

Facade defines the interface we require from the machine undertaker facade.

type Logger Uses

type Logger interface {
    Tracef(string, ...interface{})
    Debugf(string, ...interface{})
    Infof(string, ...interface{})
    Errorf(string, ...interface{})

Logger represents the methods used by the worker to log details.

type ManifoldConfig Uses

type ManifoldConfig struct {
    APICallerName string
    EnvironName   string
    Logger        Logger

    NewWorker                    func(Facade, environs.Environ, common.CredentialAPI, Logger) (worker.Worker, error)
    NewCredentialValidatorFacade func(base.APICaller) (common.CredentialAPI, error)

ManifoldConfig defines the machine undertaker's configuration and dependencies.

type Undertaker Uses

type Undertaker struct {
    API         Facade
    Releaser    AddressReleaser
    CallContext context.ProviderCallContext
    Logger      Logger

Undertaker is responsible for doing any provider-level cleanup needed and then removing the machine.

func (*Undertaker) Handle Uses

func (u *Undertaker) Handle(<-chan struct{}) error

Handle (part of watcher.NotifyHandler) cleans up provider resources and removes machines that have been marked for removal.

func (*Undertaker) MaybeReleaseAddresses Uses

func (u *Undertaker) MaybeReleaseAddresses(machine names.MachineTag) error

MaybeReleaseAddresses releases any addresses that have been allocated to this machine by the provider (if the provider supports that).

func (*Undertaker) SetUp Uses

func (u *Undertaker) SetUp() (watcher.NotifyWatcher, error)

SetUp (part of watcher.NotifyHandler) starts watching for machine removals.

func (*Undertaker) TearDown Uses

func (u *Undertaker) TearDown() error

TearDown (part of watcher.NotifyHandler) is an opportunity to stop or release any resources created in SetUp other than the watcher, which watcher.NotifyWorker takes care of for us.

Package machineundertaker imports 12 packages (graph). Updated 2020-08-11. Refresh now. Tools for package owners.