service

package
v0.0.0-...-f88c608 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstanceProvider

type InstanceProvider interface {
	AllInstances(envcontext.ProviderCallContext) ([]instances.Instance, error)
}

InstanceProvider describes the interface that is needed from the cloud provider to implement the model migration service.

type ResourceProvider

type ResourceProvider interface {
	// AdoptResources is called when the model is moved from one
	// controller to another using model migration. Some providers tag
	// instances, disks, and cloud storage with the controller UUID to
	// aid in clean destruction. This method will be called on the
	// environ for the target controller so it can update the
	// controller tags for all of those things. For providers that do
	// not track the controller UUID, a simple method returning nil
	// will suffice. The version number of the source controller is
	// provided for backwards compatibility - if the technique used to
	// tag items changes, the version number can be used to decide how
	// to remove the old tags correctly.
	AdoptResources(envcontext.ProviderCallContext, string, version.Number) error
}

ResourceProvider describes a provider for managing cloud resources on behalf of a model.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides the means for supporting model migration actions between controllers and answering questions about the underlying model(s) that are being migrated.

func NewService

func NewService(
	instanceProviderGetter providertracker.ProviderGetter[InstanceProvider],
	resourceProviderGetter providertracker.ProviderGetter[ResourceProvider],
	st State,
) *Service

NewService is responsible for constructing a new Service to handle model migration tasks.

func (*Service) AdoptResources

func (s *Service) AdoptResources(
	ctx context.Context,
	sourceControllerVersion version.Number,
) error

AdoptResources is responsible for taking ownership of the cloud resources of a model when it has been migrated into this controller.

func (*Service) CheckMachines

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.

type State

type State interface {
	GetControllerUUID(context.Context) (string, error)
	// GetAllInstanceIDs returns all instance IDs from the current model as
	// juju/collections set.
	GetAllInstanceIDs(ctx context.Context) (set.Strings, error)
}

State defines the interface required for accessing the underlying state of the model during migration.

Jump to

Keyboard shortcuts

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