machineundertaker

package
v0.0.0-...-8ff1004 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

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

func NewWorker

func NewWorker(api Facade, env environs.Environ, credentialAPI common.CredentialAPI) (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.

Types

type AddressReleaser

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

AddressReleaser defines the interface we need from the environment networking.

type Facade

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 ManifoldConfig

type ManifoldConfig struct {
	APICallerName string
	EnvironName   string

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

ManifoldConfig defines the machine undertaker's configuration and dependencies.

type Undertaker

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

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

func (*Undertaker) Handle

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

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

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

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

func (*Undertaker) TearDown

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL