juju: github.com/juju/juju/worker/caasunitinit Index | Files

package caasunitinit

import "github.com/juju/juju/worker/caasunitinit"

Index

Package Files

initializer.go manifold.go worker.go

func InitializeUnit Uses

func InitializeUnit(params InitializeUnitParams, cancel <-chan struct{}) error

InitializeUnit with the charm and configuration.

func Manifold Uses

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.

func NewWorker Uses

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

NewWorker returns a new CAAS unit init worker.

type Client Uses

type Client interface {
    ContainerStartWatcher
}

Client provides an interface for interacting with the CAASOperator API. Subsets of this should be passed to the CAASUnitInit worker.

type Config Uses

type Config struct {
    // Logger for the worker.
    Logger Logger

    // Clock holds the clock to be used by the CAAS operator
    // for time-related operations.
    Clock clock.Clock

    // Application holds the name of the application that
    // this CAAS operator manages.
    Application string

    // 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

    // ContainerStartWatcher provides an interface for watching
    // for unit container starts.
    ContainerStartWatcher ContainerStartWatcher

    // UnitProviderIDFunc returns the ProviderID for the given unit.
    UnitProviderIDFunc func(unit names.UnitTag) (string, error)

    // Paths provides CAAS operator paths.
    Paths caasoperator.Paths

    // OperatorInfo contains serving information such as Certs and PrivateKeys.
    OperatorInfo caas.OperatorInfo

    // ExecClient is used for initilizing units.
    ExecClient exec.Executor

    // InitializeUnit with the charm and configuration.
    InitializeUnit InitializeUnitFunc
}

Config for a caasUnitInitWorker and unitInitializer

func (Config) Validate Uses

func (config Config) Validate() error

type ContainerStartWatcher Uses

type ContainerStartWatcher interface {
    WatchContainerStart(string, string) (watcher.StringsWatcher, error)
}

ContainerStartWatcher provides an interface for watching for unit container starts.

type InitializeUnitFunc Uses

type InitializeUnitFunc func(params InitializeUnitParams, cancel <-chan struct{}) error

InitializeUnitFunc returns a new worker start function to initilize the Unit.

type InitializeUnitParams Uses

type InitializeUnitParams struct {
    // UnitTag of the unit being initialized.
    UnitTag names.UnitTag

    // Logger for the worker.
    Logger Logger

    // UnitProviderIDFunc returns the ProviderID for the given unit.
    UnitProviderIDFunc func(unit names.UnitTag) (string, error)

    // Paths provides CAAS operator paths.
    Paths caasoperator.Paths

    // OperatorInfo contains serving information such as Certs and PrivateKeys.
    OperatorInfo caas.OperatorInfo

    // ExecClient is used for initilizing units.
    ExecClient exec.Executor

    // WriteFile is used to write files to the local state.
    WriteFile func(string, []byte, os.FileMode) error

    // TempDir is used for creating a temporary directory.
    TempDir func(string, string) (string, error)
}

InitializeUnitParams contains parameters and dependencies for initializing a unit.

func (InitializeUnitParams) Validate Uses

func (p InitializeUnitParams) Validate() error

Validate InitializeUnitParams

type Logger Uses

type Logger interface {
    Debugf(string, ...interface{})
    Infof(string, ...interface{})
    Errorf(string, ...interface{})
}

type ManifoldConfig Uses

type ManifoldConfig struct {
    Logger Logger

    AgentName     string
    APICallerName string
    ClockName     string

    NewWorker func(Config) (worker.Worker, error)
    NewClient func(base.APICaller) Client

    NewExecClient func(namespace string) (exec.Executor, error)

    LoadOperatorInfo func(paths caasoperator.Paths) (*caas.OperatorInfo, error)
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

func (ManifoldConfig) Validate Uses

func (config ManifoldConfig) Validate() error

Validate checks that all required configuration is provided.

Package caasunitinit imports 22 packages (graph) and is imported by 2 packages. Updated 2019-12-21. Refresh now. Tools for package owners.