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, 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.
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 Logger ¶
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 ¶
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 ¶
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 ¶
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.