Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CAASManifolds ¶
func CAASManifolds(config ManifoldsConfig) dependency.Manifolds
CAASManifolds returns a set of co-configured manifolds covering the various responsibilities of a CAAS machine agent.
func IAASManifolds ¶
func IAASManifolds(config ManifoldsConfig) dependency.Manifolds
IAASManifolds returns a set of co-configured manifolds covering the various responsibilities of a IAAS machine agent.
func MachineStartupManifold ¶
func MachineStartupManifold(config MachineStartupConfig) dependency.Manifold
MachineStartupManifold starts a worker that rely on an API connection to complete machine setup.
Types ¶
type MachineStartupConfig ¶
type MachineStartupConfig struct {
APICallerName string
MachineStartup func(context.Context, api.Connection, corelogger.Logger) error
Logger corelogger.Logger
}
MachineStartupConfig provides the dependencies for the machinestartup manifold.
func (MachineStartupConfig) Validate ¶
func (c MachineStartupConfig) Validate() error
type ManifoldsConfig ¶
type ManifoldsConfig struct {
// AgentName is the name of the machine agent, like "machine-12".
// This will never change during the execution of an agent, and
// is used to provide this as config into a worker rather than
// making the worker get it from the agent worker itself.
AgentName string
// Agent contains the agent that will be wrapped and made available to
// its dependencies via a dependency.Engine.
Agent coreagent.Agent
// AgentConfigChanged is set whenever the machine agent's config
// is updated.
AgentConfigChanged *voyeur.Value
// RootDir is the root directory that any worker that needs to
// access local filesystems should use as a base. In actual use it
// will be "" but it may be overridden in tests.
RootDir string
// PreviousAgentVersion passes through the version the machine
// agent was running before the current restart.
PreviousAgentVersion version.Number
// UpgradeStepsLock is passed to the upgrade steps gate to
// coordinate workers that shouldn't do anything until the
// upgrade-steps worker is done.
UpgradeStepsLock gate.Lock
// UpgradeCheckLock is passed to the upgrade check gate to
// coordinate workers that shouldn't do anything until the
// upgrader worker completes it's first check.
UpgradeCheckLock gate.Lock
// MachineStartup is passed to the machine manifold. It does
// machine setup work which relies on an API connection.
MachineStartup func(context.Context, api.Connection, corelogger.Logger) error
// PreUpgradeSteps is a function that is used by the upgradesteps
// worker to ensure that conditions are OK for an upgrade to
// proceed.
PreUpgradeSteps func(state.ModelType) upgrades.PreUpgradeStepsFunc
// UpgradeSteps is a function that is used by the upgradesteps
// worker to perform the upgrade steps.
UpgradeSteps upgrades.UpgradeStepsFunc
// LogSource defines the channel type used to send log message
// structs within the machine agent.
LogSource logsender.LogRecordCh
// NewDeployContext gives the tests the opportunity to create a
// deployer.Context that can be used for testing.
NewDeployContext func(deployer.ContextConfig) (deployer.Context, error)
// Clock supplies timekeeping services to various workers.
Clock clock.Clock
// ValidateMigration is called by the migrationminion during the
// migration process to check that the agent will be ok when
// connected to the new target controller.
ValidateMigration func(context.Context, base.APICaller) error
// PrometheusRegisterer is a prometheus.Registerer that may be used
// by workers to register Prometheus metric collectors.
PrometheusRegisterer prometheus.Registerer
// LocalHub is a simple pubsub that is used for internal agent
// messaging only. This is used for interactions between workers
// and the introspection worker.
LocalHub *pubsub.SimpleHub
// UpdateLoggerConfig is a function that will save the specified
// config value as the logging config in the agent.conf file.
UpdateLoggerConfig func(string) error
// NewAgentStatusSetter provides upgradesteps.StatusSetter.
NewAgentStatusSetter func(context.Context, base.APICaller) (jupgradesteps.StatusSetter, error)
// RegisterIntrospectionHTTPHandlers is a function that calls the
// supplied function to register introspection HTTP handlers. The
// function will be passed a path and a handler; the function may
// alter the path as it sees fit, e.g. by adding a prefix.
RegisterIntrospectionHTTPHandlers func(func(path string, _ http.Handler))
// MachineLock is a central source for acquiring the machine lock.
// This is used by a number of workers to ensure serialisation of actions
// across the machine.
MachineLock machinelock.Lock
// MuxShutdownWait is the maximum time the http-server worker will wait
// for all mux clients to gracefully terminate before the http-worker
// exits regardless.
MuxShutdownWait time.Duration
// NewBrokerFunc is a function opens a instance broker (LXD/KVM)
NewBrokerFunc containerbroker.NewBrokerFunc
// IsCaasConfig is true if this config is for a caas agent.
IsCaasConfig bool
// UnitEngineConfig is used by the deployer to initialize the unit's
// dependency engine when running in the nested context.
UnitEngineConfig func() dependency.EngineConfig
// SetupLogging is used by the deployer to initialize the logging
// context for the unit.
SetupLogging func(corelogger.LoggerContext, coreagent.Config)
// CharmhubHTTPClient is the HTTP client used for Charmhub API requests.
CharmhubHTTPClient HTTPClient
// S3HTTPClient is the HTTP client used for S3 API requests.
S3HTTPClient HTTPClient
// NewEnvironFunc is a function opens a provider "environment"
// (typically environs.New).
NewEnvironFunc func(context.Context, environs.OpenParams, environs.CredentialInvalidator) (environs.Environ, error)
}
ManifoldsConfig allows specialisation of the result of Manifolds.
Click to show internal directories.
Click to hide internal directories.