Documentation ¶
Index ¶
- Variables
- func LoadOperatorInfo(paths Paths) (*caas.OperatorInfo, error)
- func Manifold(config ManifoldConfig) dependency.Manifold
- func NewWorker(config Config) (worker.Worker, error)
- type ApplicationWatcher
- type CharmConfigGetter
- type CharmGetter
- type Client
- type Config
- type ContainerStartWatcher
- type Downloader
- type LocalState
- type Logger
- type ManifoldConfig
- type Paths
- type RuntimePaths
- type StateFile
- type StatePaths
- type StatusSetter
- type UnitGetter
- type UnitRemover
- type VersionSetter
Constants ¶
This section is empty.
Variables ¶
var ErrNoStateFile = errors.New("operator state file does not exist")
ErrNoStateFile is used to indicate an operator state file does not exist.
Functions ¶
func LoadOperatorInfo ¶
func LoadOperatorInfo(paths Paths) (*caas.OperatorInfo, error)
LoadOperatorInfo loads the operator info file from the state dir.
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency manifold that runs a caasoperator worker, using the resource names defined in the supplied config.
Types ¶
type ApplicationWatcher ¶
type ApplicationWatcher interface {
Watch(string) (watcher.NotifyWatcher, error)
}
ApplicationWatcher provides an interface watching for application changes.
type CharmConfigGetter ¶
type CharmConfigGetter interface { CharmConfig(string) (charm.Settings, error) WatchCharmConfig(string) (watcher.NotifyWatcher, error) }
CharmConfigGetter provides an interface for watching and getting the application's charm config settings.
type CharmGetter ¶
type CharmGetter interface {
Charm(application string) (*caasoperatorapi.CharmInfo, error)
}
CharmGetter provides an interface for getting the URL and SHA256 hash of the charm currently assigned to the application.
type Client ¶
type Client interface { CharmGetter UnitGetter UnitRemover ApplicationWatcher ContainerStartWatcher StatusSetter VersionSetter Model() (*model.Model, error) }
Client provides an interface for interacting with the CAASOperator API. Subsets of this should be passed to the CAASOperator worker.
type Config ¶
type Config struct { Logger Logger // ModelUUID is the UUID of the model. ModelUUID string // ModelName is the name of the model. ModelName string // Application holds the name of the application that // this CAAS operator manages. Application string // CharmGetter is an interface used for getting the // application's charm URL and SHA256 hash. CharmGetter CharmGetter // Clock holds the clock to be used by the CAAS operator // for time-related operations. Clock clock.Clock // DataDir holds the path to the Juju "data directory", // i.e. "/var/lib/juju" (by default). The CAAS operator // expects to find the jujud binary at <data-dir>/tools/jujud. DataDir string // ProfileDir is where the introspection scripts are written. ProfileDir string // Downloader is an interface used for downloading the // application charm. Downloader Downloader // StatusSetter is an interface used for setting the // application status. StatusSetter StatusSetter // UnitGetter is an interface for getting a unit. UnitGetter UnitGetter // UnitRemover is an interface for removing a unit. UnitRemover UnitRemover // ApplicationWatcher is an interface for getting info about an application's charm. ApplicationWatcher ApplicationWatcher // ContainerStartWatcher provides an interface for watching // for unit container starts. ContainerStartWatcher ContainerStartWatcher // VersionSetter is an interface for setting the operator agent version. VersionSetter VersionSetter // LeadershipTrackerFunc is a function for getting a leadership tracker worker. LeadershipTrackerFunc func(unitTag names.UnitTag) leadership.TrackerWorker // UniterFacadeFunc is a function for making a uniter facade. UniterFacadeFunc func(unitTag names.UnitTag) *apiuniter.State // UniterParams are parameters used to construct a uniter worker. UniterParams *uniter.UniterParams // StartUniterFunc starts a uniter worker using the given runner. StartUniterFunc func(runner *worker.Runner, params *uniter.UniterParams) error // RunListenerSocketFunc returns a socket used for the juju run listener. RunListenerSocketFunc func(*uniter.SocketConfig) (*sockets.Socket, error) // OperatorInfo contains serving information such as Certs and PrivateKeys. OperatorInfo caas.OperatorInfo // ExecClientGetter returns an exec client for initializing caas units. ExecClientGetter func() (exec.Executor, error) }
Config hold the configuration for a caasoperator worker.
type ContainerStartWatcher ¶
type ContainerStartWatcher interface {
WatchContainerStart(string, string) (watcher.StringsWatcher, error)
}
ContainerStartWatcher provides an interface for watching for unit starts.
type Downloader ¶
type Downloader interface { // Download downloads a file to a local directory, and // returns the local path to the file. Download(downloader.Request) (string, error) }
Downloader provides an interface for downloading files to disk.
type LocalState ¶
type LocalState struct { // CharmModifiedVersion increases any time the charm, // or any part of it, is changed in some way. CharmModifiedVersion int // CharmURL reports the currently installed charm URL. This is set // by the committing of deploy (install/upgrade) ops. CharmURL *charm.URL }
LocalState is a cache of the state of the operator It is generally compared to the remote state of the the application as stored in the controller.
type ManifoldConfig ¶
type ManifoldConfig struct { Logger Logger AgentName string APICallerName string ClockName string MachineLock machinelock.Lock LeadershipGuarantee time.Duration CharmDirName string ProfileDir string HookRetryStrategyName string TranslateResolverErr func(error) error NewWorker func(Config) (worker.Worker, error) NewClient func(base.APICaller) Client NewCharmDownloader func(base.APICaller) Downloader NewExecClient func(namespace string) (exec.Executor, error) RunListenerSocket func(*uniter.SocketConfig) (*sockets.Socket, error) LoadOperatorInfo func(paths Paths) (*caas.OperatorInfo, error) NewContainerStartWatcherClient func(Client) ContainerStartWatcher }
ManifoldConfig defines the names of the manifolds on which a Manifold will depend.
func (ManifoldConfig) Validate ¶
func (config ManifoldConfig) Validate() error
type Paths ¶
type Paths struct { // ToolsDir is the directory containing the jujud executable running this // process; and also containing hook tool symlinks to that executable. It's // the only path in this struct that is not typically pointing inside the // directory reserved for the exclusive use of this worker (typically // /var/lib/juju/tools ) ToolsDir string // Runtime represents the set of paths that are relevant at runtime. Runtime RuntimePaths // State represents the set of paths that hold persistent local state for // the operator. State StatePaths }
Paths represents the set of filesystem paths a caasoperator worker has reason to care about.
func NewPaths ¶
NewPaths returns the set of filesystem paths that the supplied unit should use, given the supplied root juju data directory path.
func (Paths) ComponentDir ¶
ComponentDir returns the filesystem path to the directory containing all data files for a component.
func (Paths) GetBaseDir ¶
GetBaseDir exists to satisfy the context.Paths interface.
func (Paths) GetCharmDir ¶
GetCharmDir exists to satisfy the context.Paths interface.
func (Paths) GetMetricsSpoolDir ¶
GetMetricsSpoolDir exists to satisfy the runner.Paths interface.
func (Paths) GetToolsDir ¶
GetToolsDir exists to satisfy the context.Paths interface.
type RuntimePaths ¶
type RuntimePaths struct { // JujuExecSocket listens for juju-exec invocations, and is always // active. JujuExecSocket string // HookCommandServerSocket listens for hook command invocations, and is only // active when supporting a hook execution context. HookCommandServerSocket string }
RuntimePaths represents the set of paths that are relevant at runtime.
type StateFile ¶
type StateFile struct {
// contains filtered or unexported fields
}
StateFile holds the disk state for an operator.
func NewStateFile ¶
NewStateFile returns a new StateFile using path.
func (*StateFile) Read ¶
func (f *StateFile) Read() (*LocalState, error)
Read reads a State from the file. If the file does not exist it returns ErrNoStateFile.
func (*StateFile) Write ¶
func (f *StateFile) Write(st *LocalState) error
Write stores the supplied state to the file.
type StatePaths ¶
type StatePaths struct { // BaseDir is the operator's base directory. BaseDir string // CharmDir is the directory to which the charm the operator runs is deployed. CharmDir string // OperationsFile holds information about what the operator is doing // and/or has done. OperationsFile string // BundlesDir holds downloaded charms. BundlesDir string // DeployerDir holds metadata about charms that are installing or have // been installed. DeployerDir string // MetricsSpoolDir acts as temporary storage for metrics being sent from // the operator to state. MetricsSpoolDir string }
StatePaths represents the set of paths that hold persistent local state for the operator.
type StatusSetter ¶
type StatusSetter interface { // SetStatus sets the status of an application. SetStatus( application string, status status.Status, info string, data map[string]interface{}, ) error }
StatusSetter provides an interface for setting the status of a CAAS application.
type UnitGetter ¶
type UnitGetter interface { WatchUnits(string) (watcher.StringsWatcher, error) Life(string) (life.Value, error) }
UnitGetter provides an interface for watching for the lifecycle state changes (including addition) of a specified application's units, and fetching their details.
type UnitRemover ¶
UnitRemover provides an interface for removing a unit.
type VersionSetter ¶
VersionSetter provides an interface for setting the operator agent version.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |