Documentation
¶
Index ¶
- Constants
- func BootstrapParamsPath(dataDir string) string
- func IsBootstrapController(dataDir string) bool
- func PopulateAgentBinary(ctx context.Context, dataDir string, storage AgentBinaryStorage, ...) (func(), error)
- func PopulateControllerCharm(ctx context.Context, deployer ControllerCharmDeployer) error
- type AgentBinaryStorage
- type Application
- type ApplicationService
- type BaseDeployerConfig
- type CAASDeployer
- func (b *CAASDeployer) AddControllerApplication(ctx context.Context, info DeployCharmInfo, controllerAddress string) (Unit, error)
- func (d *CAASDeployer) CompleteProcess(ctx context.Context, controllerUnit Unit) error
- func (d *CAASDeployer) ControllerAddress(context.Context) (string, error)
- func (b *CAASDeployer) ControllerCharmArch() string
- func (d *CAASDeployer) ControllerCharmBase() (corebase.Base, error)
- func (b *CAASDeployer) DeployCharmhubCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
- func (b *CAASDeployer) DeployLocalCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
- type CAASDeployerConfig
- type CharmDownloaderFunc
- type CharmHubRepoFunc
- type CharmUploader
- type CloudService
- type CloudServiceGetter
- type ControllerCharmDeployer
- type DeployCharmInfo
- type Downloader
- type HTTPClient
- type IAASDeployer
- func (b *IAASDeployer) AddControllerApplication(ctx context.Context, info DeployCharmInfo, controllerAddress string) (Unit, error)
- func (d *IAASDeployer) CompleteProcess(ctx context.Context, controllerUnit Unit) error
- func (d *IAASDeployer) ControllerAddress(context.Context) (string, error)
- func (b *IAASDeployer) ControllerCharmArch() string
- func (d *IAASDeployer) ControllerCharmBase() (corebase.Base, error)
- func (b *IAASDeployer) DeployCharmhubCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
- func (b *IAASDeployer) DeployLocalCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
- type IAASDeployerConfig
- type Machine
- type MachineGetter
- type ModelConfigService
- type OperationApplier
- type StateBackend
- type Unit
Constants ¶
const (
// AgentCompressedBinaryName is the name of the agent binary.
AgentCompressedBinaryName = "tools.tar.gz"
)
Variables ¶
This section is empty.
Functions ¶
func BootstrapParamsPath ¶
BootstrapParamsPath returns the path to the bootstrap params file.
func IsBootstrapController ¶
IsBootstrapController returns whether the controller is a bootstrap controller.
func PopulateAgentBinary ¶
func PopulateAgentBinary(ctx context.Context, dataDir string, storage AgentBinaryStorage, logger logger.Logger) (func(), error)
PopulateAgentBinary is the function that is used to populate the agent binary at bootstrap.
func PopulateControllerCharm ¶
func PopulateControllerCharm(ctx context.Context, deployer ControllerCharmDeployer) error
PopulateControllerCharm is the function that is used to populate the controller charm. When deploying a local charm, it is expected that the charm is located in a certain location. If the charm is not located there, we'll get an error indicating that the charm is not found. If the errors is not found locally, we'll try to download it from charm hub. Once the charm is added, set up the controller application.
Types ¶
type AgentBinaryStorage ¶
type AgentBinaryStorage interface { // Add adds the agent binary to the storage. Add(context.Context, io.Reader, binarystorage.Metadata) error }
AgentBinaryStorage is the interface that is used to store the agent binary.
type Application ¶
type Application interface {
Name() string
}
Application is the interface that is used to get information about an application.
type ApplicationService ¶
type ApplicationService interface { // CreateApplication creates a new application with the given name and // charm. CreateApplication( context.Context, string, charm.Charm, corecharm.Origin, applicationservice.AddApplicationArgs, ...applicationservice.AddUnitArg, ) (coreapplication.ID, error) // ResolveControllerCharmDownload resolves the controller charm download slot. ResolveControllerCharmDownload( ctx context.Context, resolve application.ResolveControllerCharmDownload, ) (application.ResolvedControllerCharmDownload, error) // UpdateApplication updates the application with the given name. UpdateCAASUnit(ctx context.Context, unitName unit.Name, params applicationservice.UpdateCAASUnitParams) error // SetUnitPassword sets the password for the given unit. SetUnitPassword(ctx context.Context, unitName unit.Name, passwordHash string) error }
ApplicationService instances create an application.
type BaseDeployerConfig ¶
type BaseDeployerConfig struct { DataDir string StateBackend StateBackend ApplicationService ApplicationService ModelConfigService ModelConfigService CharmUploader CharmUploader ObjectStore objectstore.ObjectStore Constraints constraints.Value ControllerConfig controller.Config NewCharmHubRepo CharmHubRepoFunc NewCharmDownloader CharmDownloaderFunc CharmhubHTTPClient HTTPClient ControllerCharmName string Channel charm.Channel Logger logger.Logger }
BaseDeployerConfig holds the configuration for a baseDeployer.
func (BaseDeployerConfig) Validate ¶
func (c BaseDeployerConfig) Validate() error
Validate validates the configuration.
type CAASDeployer ¶
type CAASDeployer struct {
// contains filtered or unexported fields
}
CAASDeployer is the interface that is used to deploy the controller charm for CAAS workloads.
func NewCAASDeployer ¶
func NewCAASDeployer(config CAASDeployerConfig) (*CAASDeployer, error)
NewCAASDeployer returns a new ControllerCharmDeployer for CAAS workloads.
func (*CAASDeployer) AddControllerApplication ¶
func (b *CAASDeployer) AddControllerApplication(ctx context.Context, info DeployCharmInfo, controllerAddress string) (Unit, error)
AddControllerApplication adds the controller application.
func (*CAASDeployer) CompleteProcess ¶
func (d *CAASDeployer) CompleteProcess(ctx context.Context, controllerUnit Unit) error
CompleteProcess is called when the bootstrap process is complete.
func (*CAASDeployer) ControllerAddress ¶
func (d *CAASDeployer) ControllerAddress(context.Context) (string, error)
ControllerAddress returns the address of the controller that should be used.
func (*CAASDeployer) ControllerCharmArch ¶
func (b *CAASDeployer) ControllerCharmArch() string
ControllerCharmArch returns the architecture used for deploying the controller charm.
func (*CAASDeployer) ControllerCharmBase ¶
func (d *CAASDeployer) ControllerCharmBase() (corebase.Base, error)
ControllerCharmBase returns the base used for deploying the controller charm.
func (*CAASDeployer) DeployCharmhubCharm ¶
func (b *CAASDeployer) DeployCharmhubCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
DeployCharmhubCharm deploys the controller charm from charm hub.
func (*CAASDeployer) DeployLocalCharm ¶
func (b *CAASDeployer) DeployLocalCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
DeployLocalCharm deploys the controller charm from the local charm store.
type CAASDeployerConfig ¶
type CAASDeployerConfig struct { BaseDeployerConfig CloudServiceGetter CloudServiceGetter OperationApplier OperationApplier UnitPassword string }
CAASDeployerConfig holds the configuration for a CAASDeployer.
func (CAASDeployerConfig) Validate ¶
func (c CAASDeployerConfig) Validate() error
Validate validates the configuration.
type CharmDownloaderFunc ¶
type CharmDownloaderFunc func(HTTPClient, logger.Logger) Downloader
CharmDownloaderFunc is the function that is used to create a charm downloader.
type CharmHubRepoFunc ¶
type CharmHubRepoFunc func(repository.CharmHubRepositoryConfig) (corecharm.Repository, error)
CharmHubRepoFunc is the function that is used to create a charm repository.
type CharmUploader ¶
type CharmUploader interface {
ModelUUID() string
}
CharmUploader is an interface that is used to update the charm in state and upload it to the object store.
type CloudService ¶
type CloudService interface {
Addresses() network.SpaceAddresses
}
CloudService is the interface that is used to get the cloud service for the controller.
type CloudServiceGetter ¶
type CloudServiceGetter interface {
CloudService(string) (CloudService, error)
}
CloudServiceGetter is the interface that is used to get the cloud service for the controller.
type ControllerCharmDeployer ¶
type ControllerCharmDeployer interface { // DeployLocalCharm deploys the controller charm from the local charm // store. DeployLocalCharm(context.Context, string, corebase.Base) (DeployCharmInfo, error) // DeployCharmhubCharm deploys the controller charm from charm hub. DeployCharmhubCharm(context.Context, string, corebase.Base) (DeployCharmInfo, error) // AddControllerApplication adds the controller application. AddControllerApplication(context.Context, DeployCharmInfo, string) (Unit, error) // ControllerAddress returns the address of the controller that should be // used. ControllerAddress(context.Context) (string, error) // ControllerCharmBase returns the base used for deploying the controller // charm. ControllerCharmBase() (corebase.Base, error) // ControllerCharmArch returns the architecture used for deploying the // controller charm. ControllerCharmArch() string // CompleteProcess is called when the bootstrap process is complete. CompleteProcess(context.Context, Unit) error }
ControllerCharmDeployer is the interface that is used to deploy the controller charm.
type DeployCharmInfo ¶
type DeployCharmInfo struct { URL *charm.URL Charm charm.Charm Origin *corecharm.Origin DownloadInfo *corecharm.DownloadInfo ArchivePath string ObjectStoreUUID objectstore.UUID }
DeployCharmResult holds the result of deploying a charm.
func (DeployCharmInfo) Validate ¶
func (d DeployCharmInfo) Validate() error
Validate validates the DeployCharmInfo.
type Downloader ¶
type Downloader interface { // Download looks up the requested charm using the appropriate store, downloads // it to a temporary file and passes it to the configured storage API so it can // be persisted. // // The resulting charm is verified to be the right hash. It expected that the // origin will always have the correct hash following this call. // // Returns [ErrInvalidHash] if the hash of the downloaded charm does not match // the expected hash. Download(ctx context.Context, url *url.URL, hash string) (*charmdownloader.DownloadResult, error) }
Downloader defines an API for downloading and storing charms.
type HTTPClient ¶
HTTPClient is the interface that is used to make HTTP requests.
type IAASDeployer ¶
type IAASDeployer struct {
// contains filtered or unexported fields
}
IAASDeployer is the interface that is used to deploy the controller charm for IAAS workloads.
func NewIAASDeployer ¶
func NewIAASDeployer(config IAASDeployerConfig) (*IAASDeployer, error)
NewIAASDeployer returns a new ControllerCharmDeployer for IAAS workloads.
func (*IAASDeployer) AddControllerApplication ¶
func (b *IAASDeployer) AddControllerApplication(ctx context.Context, info DeployCharmInfo, controllerAddress string) (Unit, error)
AddControllerApplication adds the controller application.
func (*IAASDeployer) CompleteProcess ¶
func (d *IAASDeployer) CompleteProcess(ctx context.Context, controllerUnit Unit) error
CompleteProcess is called when the bootstrap process is complete.
func (*IAASDeployer) ControllerAddress ¶
func (d *IAASDeployer) ControllerAddress(context.Context) (string, error)
ControllerAddress returns the address of the controller that should be used.
func (*IAASDeployer) ControllerCharmArch ¶
func (b *IAASDeployer) ControllerCharmArch() string
ControllerCharmArch returns the architecture used for deploying the controller charm.
func (*IAASDeployer) ControllerCharmBase ¶
func (d *IAASDeployer) ControllerCharmBase() (corebase.Base, error)
ControllerCharmBase returns the base used for deploying the controller charm.
func (*IAASDeployer) DeployCharmhubCharm ¶
func (b *IAASDeployer) DeployCharmhubCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
DeployCharmhubCharm deploys the controller charm from charm hub.
func (*IAASDeployer) DeployLocalCharm ¶
func (b *IAASDeployer) DeployLocalCharm(ctx context.Context, arch string, base corebase.Base) (DeployCharmInfo, error)
DeployLocalCharm deploys the controller charm from the local charm store.
type IAASDeployerConfig ¶
type IAASDeployerConfig struct { BaseDeployerConfig MachineGetter MachineGetter }
IAASDeployerConfig holds the configuration for a IAASDeployer.
func (IAASDeployerConfig) Validate ¶
func (c IAASDeployerConfig) Validate() error
Validate validates the configuration.
type Machine ¶
type Machine interface { DocID() string Id() string MachineTag() names.MachineTag Life() state.Life Clean() bool ContainerType() instance.ContainerType Base() state.Base Jobs() []state.MachineJob AddPrincipal(string) FileSystems() []string PublicAddress() (network.SpaceAddress, error) }
Machine is the interface that is used to get information about a machine.
type MachineGetter ¶
MachineGetter is the interface that is used to get information about a machine.
type ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the current config for the model. ModelConfig(context.Context) (*config.Config, error) }
ModelConfigService provides access to the model configuration.
type OperationApplier ¶
type OperationApplier interface { // ApplyOperation applies the given operation. ApplyOperation(*state.UpdateUnitOperation) error }
OperationApplier is the interface that is used to apply operations.
type StateBackend ¶
type StateBackend interface { AddApplication(state.AddApplicationArgs, objectstore.ObjectStore) (Application, error) Unit(string) (Unit, error) }
StateBackend is the interface that is used to get information about the state.
type Unit ¶
type Unit interface { // UpdateOperation returns a model operation that will update a unit. UpdateOperation(state.UnitUpdateProperties) *state.UpdateUnitOperation // AssignToMachineRef assigns this unit to a given machine. AssignToMachineRef(state.MachineRef) error // UnitTag returns the tag of the unit. UnitTag() names.UnitTag // SetPassword sets the password for the unit. SetPassword(string) error }
Unit is the interface that is used to get information about a controller unit.