Documentation
¶
Overview ¶
Package migrationtarget defines the API facade for use by the migration master worker when interacting with the target controller during a migration.
Index ¶
- func Register(requiredMigrationFacadeVersions facades.FacadeVersions) func(registry facade.FacadeRegistry)
- type API
- func (api *API) Abort(ctx context.Context, args params.ModelArgs) error
- func (api *API) Activate(ctx context.Context, args params.ActivateModelArgs) error
- func (api *API) AdoptResources(ctx context.Context, args params.AdoptResourcesArgs) error
- func (api *API) CACert(ctx context.Context) (params.BytesResult, error)
- func (api *API) CheckMachines(ctx context.Context, args params.ModelArgs) (params.ErrorResults, error)
- func (api *API) Import(ctx context.Context, serialized params.SerializedModel) error
- func (api *API) LatestLogTime(ctx context.Context, args params.ModelArgs) (time.Time, error)
- func (api *API) Prechecks(ctx context.Context, model params.MigrationModelInfo) error
- type ApplicationService
- type ControllerConfigService
- type ExternalControllerService
- type ModelAgentService
- type ModelAgentServiceGetter
- type ModelImporter
- type ModelManagerService
- type ModelMigrationService
- type ModelMigrationServiceGetter
- type UpgradeService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(requiredMigrationFacadeVersions facades.FacadeVersions) func(registry facade.FacadeRegistry)
Register is called to expose a package of facades onto a given registry.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API implements the API required for the model migration master worker when communicating with the target controller.
func NewAPI ¶
func NewAPI( ctx facade.ModelContext, authorizer facade.Authorizer, controllerConfigService ControllerConfigService, externalControllerService ExternalControllerService, applicationService ApplicationService, upgradeService UpgradeService, modelAgentServiceGetter ModelAgentServiceGetter, modelMigrationServiceGetter ModelMigrationServiceGetter, requiredMigrationFacadeVersions facades.FacadeVersions, logDir string, ) (*API, error)
NewAPI returns a new migration target api. Accepts a NewEnvironFunc and envcontext.ProviderCallContext for testing purposes.
func (*API) Abort ¶
Abort removes the specified model from the database. It is an error to attempt to Abort a model that has a migration mode other than importing.
func (*API) Activate ¶
Activate sets the migration mode of the model to "none", meaning it is ready for use. It also adds any required external controller records for those controllers hosting offers used by the model.
func (*API) AdoptResources ¶
AdoptResources asks the cloud provider to update the controller tags for a model's resources. This prevents the resources from being destroyed if the source controller is destroyed after the model is migrated away.
func (*API) CheckMachines ¶
func (api *API) CheckMachines(ctx context.Context, args params.ModelArgs) (params.ErrorResults, error)
CheckMachines compares the machines in state with the ones reported by the provider and reports any discrepancies.
func (*API) Import ¶
Import takes a serialized Juju model, deserializes it, and recreates it in the receiving controller.
func (*API) LatestLogTime ¶
LatestLogTime returns the time of the most recent log record received by the logtransfer endpoint. This can be used as the start point for streaming logs from the source if the transfer was interrupted.
Log messages are assumed to be sent in time order (which is how debug-log emits them). If that isn't the case then this mechanism can't be used to avoid duplicates when logtransfer is restarted.
Returns the zero time if no logs have been transferred.
type ApplicationService ¶
type ApplicationService interface { // GetApplicationLife returns the life value of the application with the given name. GetApplicationLife(ctx context.Context, name string) (life.Value, error) // GetUnitWorkloadStatus returns the workload status of the specified unit. GetUnitWorkloadStatus(context.Context, unit.Name) (*status.StatusInfo, error) }
ApplicationService provides access to the application service.
type ControllerConfigService ¶
type ControllerConfigService interface { // ControllerConfig returns the controller config. ControllerConfig(context.Context) (controller.Config, error) }
ControllerConfigService provides a subset of the controller config domain service methods.
type ExternalControllerService ¶
type ExternalControllerService interface { // ControllerForModel returns the controller record that's associated // with the modelUUID. ControllerForModel(ctx context.Context, modelUUID string) (*crossmodel.ControllerInfo, error) // UpdateExternalController persists the input controller // record. UpdateExternalController(ctx context.Context, ec crossmodel.ControllerInfo) error }
ExternalControllerService provides a subset of the external controller domain service methods.
type ModelAgentService ¶
type ModelAgentService interface { // GetModelTargetAgentVersion returns the target agent version for the // entire model. The following errors can be returned: // - [github.com/juju/juju/domain/model/errors.NotFound] - When the model does // not exist. GetModelTargetAgentVersion(context.Context) (version.Number, error) }
ModelAgentService provides access to the Juju agent version for the model.
type ModelAgentServiceGetter ¶
type ModelAgentServiceGetter func(modelId coremodel.UUID) ModelAgentService
ModelAgentServiceGetter describes a function that is able to return the ModelAgentService for a given model id.
type ModelImporter ¶
type ModelImporter interface { // ImportModel takes a serialized description model (yaml bytes) and returns // a state model and state state. ImportModel(ctx context.Context, bytes []byte) (*state.Model, *state.State, error) }
ModelImporter defines an interface for importing models.
type ModelManagerService ¶
ModelManagerService describes the method needed to update model metadata.
type ModelMigrationService ¶
type ModelMigrationService interface { // AdoptResources is responsible for taking ownership of the cloud resources // of a model when it has been migrated into this controller. AdoptResources(context.Context, version.Number) error // CheckMachines is responsible for checking a model after it has been // migrated into this target controller. We check the machines that exist in // the model against the machines reported by the models cloud and report // any discrepancies. CheckMachines(context.Context) ([]modelmigration.MigrationMachineDiscrepancy, error) }
ModelMigrationService provides the means for supporting model migration actions between controllers and answering questions about the underlying model(s) that are being migrated.
type ModelMigrationServiceGetter ¶
type ModelMigrationServiceGetter func(coremodel.UUID) ModelMigrationService
ModelMigrationServiceGetter describes a function that is able to return the ModelMigrationService for a given model id.