instancemutater

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrokerAPIManifold

func BrokerAPIManifold(config BrokerAPIConfig, start BrokerAPIStartFunc) dependency.Manifold

BrokerAPIManifold returns a dependency.Manifold that calls the supplied start func with the API and envrion resources defined in the config (once those resources are present).

func EnvironAPIManifold

func EnvironAPIManifold(config EnvironAPIConfig, start EnvironAPIStartFunc) dependency.Manifold

EnvironAPIManifold returns a dependency.Manifold that calls the supplied start func with the API and envrion resources defined in the config (once those resources are present).

func MachineManifold

func MachineManifold(config MachineManifoldConfig) dependency.Manifold

MachineManifold returns a Manifold that encapsulates the instancemutater worker.

func ModelManifold

func ModelManifold(config ModelManifoldConfig) dependency.Manifold

ModelManifold returns a Manifold that encapsulates the instancemutater worker.

func NewContainerWorker

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

NewContainerWorker returns a worker that keeps track of the containers in the state for this machine agent and polls their instance for addition or removal changes.

func NewEnvironWorker

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

NewEnvironWorker returns a worker that keeps track of the machines in the state and polls their instance for addition or removal changes.

Types

type BrokerAPIConfig

type BrokerAPIConfig struct {
	BrokerName    string
	APICallerName string
	AgentName     string
}

BrokerAPIConfig represents a typed manifold starter func, that handles getting resources from the configuration.

type BrokerAPIStartFunc

type BrokerAPIStartFunc func(environs.InstanceBroker, base.APICaller, agent.Agent) (worker.Worker, error)

BrokerAPIStartFunc encapsulates creation of a worker based on the environ and APICaller.

type Config

type Config struct {
	Facade InstanceMutaterAPI

	// Logger is the Logger for this worker.
	Logger Logger

	Broker environs.LXDProfiler

	AgentConfig agent.Config

	// Tag is the current MutaterMachine tag
	Tag names.Tag

	// GetMachineWatcher allows the worker to watch different "machines"
	// depending on whether this work is running with an environ broker
	// or a container broker.
	GetMachineWatcher func() (watcher.StringsWatcher, error)

	// GetRequiredLXDProfiles provides a slice of strings representing the
	// lxd profiles to be included on every LXD machine used given the
	// current model name.
	GetRequiredLXDProfiles RequiredLXDProfilesFunc

	// GetRequiredContext provides a way to override the given context
	// Note: the following is required for testing purposes when we have an
	// error case and we want to know when it's valid to kill/clean the worker.
	GetRequiredContext RequiredMutaterContextFunc
}

Config represents the configuration required to run a new instance machineApi worker.

func (Config) Validate

func (config Config) Validate() error

Validate checks for missing values from the configuration and checks that they conform to a given type.

type EnvironAPIConfig

type EnvironAPIConfig struct {
	EnvironName   string
	APICallerName string
	AgentName     string
}

EnvironAPIConfig represents a typed manifold starter func, that handles getting resources from the configuration.

type EnvironAPIStartFunc

type EnvironAPIStartFunc func(environs.Environ, base.APICaller, agent.Agent) (worker.Worker, error)

EnvironAPIStartFunc encapsulates creation of a worker based on the environ and APICaller.

type InstanceMutaterAPI

type InstanceMutaterAPI interface {
	WatchMachines() (watcher.StringsWatcher, error)
	Machine(tag names.MachineTag) (instancemutater.MutaterMachine, error)
}

func NewClient

func NewClient(apiCaller base.APICaller) InstanceMutaterAPI

type Logger

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

Logger represents the logging methods called.

type MachineContext

type MachineContext interface {
	// contains filtered or unexported methods
}

type MachineManifoldConfig

type MachineManifoldConfig struct {
	APICallerName string
	BrokerName    string
	AgentName     string

	Logger    Logger
	NewWorker func(Config) (worker.Worker, error)
	NewClient func(base.APICaller) InstanceMutaterAPI
}

MachineManifoldConfig describes the resources used by the instancemuter worker.

func (MachineManifoldConfig) Validate

func (config MachineManifoldConfig) Validate() error

Validate validates the manifold configuration.

type ModelManifoldConfig

type ModelManifoldConfig struct {
	APICallerName string
	EnvironName   string
	AgentName     string

	Logger    Logger
	NewWorker func(Config) (worker.Worker, error)
	NewClient func(base.APICaller) InstanceMutaterAPI
}

ModelManifoldConfig describes the resources used by the instancemuter worker.

func (ModelManifoldConfig) Validate

func (config ModelManifoldConfig) Validate() error

Validate validates the manifold configuration.

type MutaterContext

type MutaterContext interface {
	MachineContext
	// contains filtered or unexported methods
}

type MutaterMachine

type MutaterMachine struct {
	// contains filtered or unexported fields
}

type RequiredLXDProfilesFunc

type RequiredLXDProfilesFunc func(string) []string

type RequiredMutaterContextFunc

type RequiredMutaterContextFunc func(MutaterContext) MutaterContext

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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