caasunitprovisioner

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold creates a manifold that runs a CAAS unit provisioner. See the ManifoldConfig type for discussion about how this can/should evolve.

func NewWorker

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

NewWorker starts and returns a new CAAS unit provisioner worker.

Types

type ApplicationGetter

type ApplicationGetter interface {
	WatchApplications() (watcher.StringsWatcher, error)
	WatchApplication(appName string) (watcher.NotifyWatcher, error)
	ApplicationConfig(string) (config.ConfigAttributes, error)
	DeploymentMode(string) (caas.DeploymentMode, error)
	WatchApplicationScale(string) (watcher.NotifyWatcher, error)
	ApplicationScale(string) (int, error)
}

ApplicationGetter provides an interface for watching for the lifecycle state changes (including addition) of applications in the model, and fetching their details.

type ApplicationUpdater

type ApplicationUpdater interface {
	UpdateApplicationService(arg params.UpdateApplicationServiceArg) error
	ClearApplicationResources(appName string) error
}

ApplicationUpdater provides an interface for updating Juju applications from changes in the cloud.

type CharmGetter

type CharmGetter interface {
	ApplicationCharmInfo(appName string) (*charmscommon.CharmInfo, error)
}

type Client

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

type Config

type Config struct {
	ApplicationGetter  ApplicationGetter
	ApplicationUpdater ApplicationUpdater
	ServiceBroker      ServiceBroker

	ContainerBroker          ContainerBroker
	ProvisioningInfoGetter   ProvisioningInfoGetter
	ProvisioningStatusSetter ProvisioningStatusSetter
	LifeGetter               LifeGetter
	UnitUpdater              UnitUpdater
	CharmGetter              CharmGetter

	Logger Logger
}

Config holds configuration for the CAAS unit provisioner worker.

func (Config) Validate

func (config Config) Validate() error

Validate validates the worker configuration.

type ContainerBroker

type ContainerBroker interface {
	Provider() caas.ContainerEnvironProvider
	WatchOperator(string) (watcher.NotifyWatcher, error)
	Operator(string) (*caas.Operator, error)

	WatchUnits(appName string, mode caas.DeploymentMode) (watcher.NotifyWatcher, error)
	Units(appName string, mode caas.DeploymentMode) ([]caas.Unit, error)
	AnnotateUnit(appName string, mode caas.DeploymentMode, podName string, unit names.UnitTag) error
}

type LifeGetter

type LifeGetter interface {
	Life(string) (life.Value, error)
}

LifeGetter provides an interface for getting the lifecycle state value for an application or unit.

type Logger

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

Logger represents the methods used by the worker to log details.

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName string
	BrokerName    string

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

ManifoldConfig defines a CAAS unit provisioner's dependencies.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate is called by start to check for bad configuration.

type ProvisioningInfoGetter

type ProvisioningInfoGetter interface {
	ProvisioningInfo(appName string) (*apicaasunitprovisioner.ProvisioningInfo, error)
	WatchPodSpec(appName string) (watcher.NotifyWatcher, error)
}

ProvisioningInfoGetter provides an interface for watching and getting the pod spec and other info needed to provision an application.

type ProvisioningStatusSetter

type ProvisioningStatusSetter interface {
	// SetOperatorStatus sets the status for the application operator.
	SetOperatorStatus(appName string, status status.Status, message string, data map[string]interface{}) error
}

ProvisioningStatusSetter provides an interface for setting status information.

type ServiceBroker

type ServiceBroker interface {
	Provider() caas.ContainerEnvironProvider
	EnsureService(appName string, statusCallback caas.StatusCallbackFunc, params *caas.ServiceParams, numUnits int, config config.ConfigAttributes) error
	DeleteService(appName string) error
	UnexposeService(appName string) error

	GetService(appName string, mode caas.DeploymentMode, includeClusterIP bool) (*caas.Service, error)
	WatchService(appName string, mode caas.DeploymentMode) (watcher.NotifyWatcher, error)
}

type UnitUpdater

type UnitUpdater interface {
	UpdateUnits(arg params.UpdateApplicationUnits) (*params.UpdateApplicationUnitsInfo, error)
}

UnitUpdater provides an interface for updating Juju units from changes in the cloud.

Jump to

Keyboard shortcuts

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