upgradevalidation

package
v0.0.0-...-51a0f74 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MinAgentVersions = map[int]version.Number{
	3: version.MustParse("2.9.43"),
}

MinAgentVersions defines the minimum agent version allowed to make a call to a controller with the major version.

View Source
var MinClientVersions = map[int]version.Number{
	3: version.MustParse("2.9.42"),
}

MinClientVersions defines the minimum user client version allowed to make a call to a controller with the major version, or the minimum controller version needed to accept a call from a client with the major version.

View Source
var MinMajorMigrateVersions = MinAgentVersions

MinMajorMigrateVersions defines the minimum version the model must be running before migrating to the target controller.

View Source
var NewServerFactory = lxd.NewServerFactory

For testing.

Functions

func MigrateToAllowed

func MigrateToAllowed(modelVersion, targetControllerVersion version.Number) (bool, version.Number, error)

MigrateToAllowed checks if the model can be migrated to the target controller.

func UpgradeControllerAllowed

func UpgradeControllerAllowed(modelVersion, targetControllerVersion version.Number) (bool, version.Number, error)

UpgradeControllerAllowed returns true if a controller upgrade is allowed when it hosts a model with the specified version.

Types

type Blocker

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

Blocker describes a model upgrade blocker.

func NewBlocker

func NewBlocker(format string, a ...any) *Blocker

NewBlocker returns a block.

func (Blocker) Error

func (b Blocker) Error() string

func (Blocker) String

func (b Blocker) String() string

String returns the Blocker as a string.

type Model

type Model interface {
	Name() string
	Owner() names.UserTag
	AgentVersion() (version.Number, error)
	MigrationMode() state.MigrationMode
}

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

type ModelUpgradeBlockers

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

ModelUpgradeBlockers holds a list of blockers for upgrading the provided model.

func NewModelUpgradeBlockers

func NewModelUpgradeBlockers(modelName string, blockers ...Blocker) *ModelUpgradeBlockers

NewModelUpgradeBlockers creates a ModelUpgradeBlockers.

func (*ModelUpgradeBlockers) Join

Join links the provided ModelUpgradeBlockers as the next node.

func (ModelUpgradeBlockers) String

func (e ModelUpgradeBlockers) String() string

String returns the ModelUpgradeBlockers as a string.

type ModelUpgradeCheck

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

ModelUpgradeCheck sumarizes a list of blockers for upgrading the provided model.

func NewModelUpgradeCheck

func NewModelUpgradeCheck(
	modelUUID string, pool StatePool, state State, model Model,
	validators ...Validator,
) *ModelUpgradeCheck

NewModelUpgradeCheck returns a ModelUpgradeCheck instance.

func (*ModelUpgradeCheck) Validate

func (m *ModelUpgradeCheck) Validate() (*ModelUpgradeBlockers, error)

Validate runs the provided validators and returns blocks.

type State

type State interface {
	AllCharmURLs() ([]*string, error)
	HasUpgradeSeriesLocks() (bool, error)
	MachineCountForBase(base ...state.Base) (map[string]int, error)
	MongoCurrentStatus() (*replicaset.Status, error)
}

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

type StatePool

type StatePool interface {
	MongoVersion() (string, error)
}

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

type Validator

type Validator func(modelUUID string, pool StatePool, st State, model Model) (*Blocker, error)

Validator returns a blocker.

func ValidatorsForControllerUpgrade

func ValidatorsForControllerUpgrade(
	isControllerModel bool, targetVersion version.Number, cloudspec environscloudspec.CloudSpec,
) []Validator

ValidatorsForControllerUpgrade returns a list of validators for controller upgrade. Note: the target version can never be lower than the current version.

func ValidatorsForModelMigrationSource

func ValidatorsForModelMigrationSource(
	cloudspec environscloudspec.CloudSpec,
) []Validator

ValidatorsForModelMigrationSource returns a list of validators to run source controller for model migration. Note: the target version can never be lower than the current version.

func ValidatorsForModelUpgrade

func ValidatorsForModelUpgrade(
	force bool, targetVersion version.Number, cloudspec environscloudspec.CloudSpec,
) []Validator

ValidatorsForModelUpgrade returns a list of validators for model upgrade. Note: the target version can never be lower than the current version.

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