bootstrap

package
v0.0.0-...-0a82276 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AgentCompressedBinaryName is the name of the agent binary.
	AgentCompressedBinaryName = "tools.tar.gz"
)

Variables

This section is empty.

Functions

func BootstrapParamsPath

func BootstrapParamsPath(dataDir string) string

BootstrapParamsPath returns the path to the bootstrap params file.

func IsBootstrapController

func IsBootstrapController(dataDir string) bool

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(
		context.Context, string, charm.Charm, corecharm.Origin,
		applicationservice.AddApplicationArgs, ...applicationservice.AddUnitArg,
	) (coreapplication.ID, error)

	UpdateCAASUnit(ctx context.Context, unitName unit.Name, params applicationservice.UpdateCAASUnitParams) error

	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
	NewCharmRepo        CharmRepoFunc
	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, curl string, origin corecharm.Origin, 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) (string, *corecharm.Origin, error)

DeployCharmhubCharm deploys the controller charm from charm hub.

func (*CAASDeployer) DeployLocalCharm

func (b *CAASDeployer) DeployLocalCharm(ctx context.Context, arch string, base corebase.Base) (string, *corecharm.Origin, 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 Charm

type Charm interface {
	Meta() *charm.Meta
	Manifest() *charm.Manifest
	Actions() *charm.Actions
	Config() *charm.Config
	Revision() int
	URL() string
}

Charm is the interface that is used to get information about a charm.

type CharmDownloaderFunc

type CharmDownloaderFunc func(services.CharmDownloaderConfig) (Downloader, error)

CharmDownloaderFunc is the function that is used to create a charm downloader.

type CharmRepoFunc

CharmRepoFunc is the function that is used to create a charm repository.

type CharmUploader

type CharmUploader interface {
	PrepareLocalCharmUpload(url string) (chosenURL *charm.URL, err error)
	UpdateUploadedCharm(info state.CharmInfo) (services.UploadedCharm, error)
	PrepareCharmUpload(curl string) (services.UploadedCharm, error)
	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) (string, *corecharm.Origin, error)

	// DeployCharmhubCharm deploys the controller charm from charm hub.
	DeployCharmhubCharm(context.Context, string, corebase.Base) (string, *corecharm.Origin, error)

	// AddControllerApplication adds the controller application.
	AddControllerApplication(context.Context, string, corecharm.Origin, 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 Downloader

type Downloader interface {
	DownloadAndStore(ctx context.Context, charmURL *charm.URL, requestedOrigin corecharm.Origin, force bool) (corecharm.Origin, error)
}

Downloader defines an API for downloading and storing charms.

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

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, curl string, origin corecharm.Origin, 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) (string, *corecharm.Origin, error)

DeployCharmhubCharm deploys the controller charm from charm hub.

func (*IAASDeployer) DeployLocalCharm

func (b *IAASDeployer) DeployLocalCharm(ctx context.Context, arch string, base corebase.Base) (string, *corecharm.Origin, 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

type MachineGetter interface {
	Machine(string) (Machine, error)
}

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)
	Charm(string) (Charm, 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.

Jump to

Keyboard shortcuts

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