modelupgrader

package
v0.0.0-...-0a271de 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: 35 Imported by: 2

Documentation

Overview

Package modelupgrader defines an API endpoint for functions dealing with upgrading models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type ConfigSource

type ConfigSource interface {
	Config() (*config.Config, error)
}

ConfigSource describes a type that is able to provide config. Abstracted primarily for testing.

type ControllerConfigService

type ControllerConfigService interface {
	ControllerConfig(context.Context) (controller.Config, error)
}

ControllerConfigService is an interface that allows us to get the controller config.

type Model

type Model interface {
	IsControllerModel() bool

	Owner() names.UserTag
	Name() string
	MigrationMode() state.MigrationMode
	Type() state.ModelType
	Life() state.Life
}

Model defines a point of use interface for the model from state.

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 ModelUpgraderAPI

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

ModelUpgraderAPI implements the model upgrader interface and is the concrete implementation of the api end point.

func NewModelUpgraderAPI

func NewModelUpgraderAPI(
	controllerTag names.ControllerTag,
	stPool StatePool,
	toolsFinder common.ToolsFinder,
	newEnviron common.NewEnvironFunc,
	blockChecker common.BlockCheckerInterface,
	authorizer facade.Authorizer,
	credentialInvalidatorGetter envcontext.ModelCredentialInvalidatorGetter,
	registryAPIFunc func(docker.ImageRepoDetails) (registry.Registry, error),
	environscloudspecGetter func(context.Context, names.ModelTag) (environscloudspec.CloudSpec, error),
	modelAgentServiceGetter func(modelID coremodel.UUID) ModelAgentService,
	controllerAgentService ModelAgentService,
	controllerConfigService ControllerConfigService,
	upgradeService UpgradeService,
	logger corelogger.Logger,
) (*ModelUpgraderAPI, error)

NewModelUpgraderAPI creates a new api server endpoint for managing models.

func (*ModelUpgraderAPI) AbortModelUpgrade

func (m *ModelUpgraderAPI) AbortModelUpgrade(ctx context.Context, arg params.ModelParam) error

AbortModelUpgrade returns not supported, as it's not possible to move back to a prior version.

func (*ModelUpgraderAPI) UpgradeModel

func (m *ModelUpgraderAPI) UpgradeModel(ctx context.Context, arg params.UpgradeModelParams) (result params.UpgradeModelResult, err error)

UpgradeModel upgrades a model.

type State

type State interface {
	Model() (Model, error)
	Release() bool
	AllModelUUIDs() ([]string, error)
	MachineCountForBase(base ...state.Base) (map[string]int, error)
	AllMachinesCount() (int, error)
	MongoCurrentStatus() (*replicaset.Status, error)
	SetModelAgentVersion(newVersion version.Number, stream *string, ignoreAgentVersions bool, upgrader state.Upgrader) error
}

State represents a point of use interface for modelling a current model.

type StatePool

type StatePool interface {
	Get(string) (State, error)
	ControllerModel() (Model, error)
	MongoVersion() (string, error)
}

StatePool represents a point of use interface for getting the state from the pool.

type SystemState

type SystemState interface {
	ControllerModel() (Model, error)
}

type UpgradeService

type UpgradeService interface {
	IsUpgrading(context.Context) (bool, error)
}

UpgradeService is an interface that allows us to check if the model is currently upgrading.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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