upgradevalidation

package
v0.0.0-...-4308112 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: AGPL-3.0 Imports: 17 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 NewServerFactory = lxd.NewServerFactory

For testing.

View Source
var SupportedJujuBases = corebase.WorkloadBases

For testing. TODO: unexport it if we don't need to patch it anymore.

Functions

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
	MigrationMode() state.MigrationMode
}

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 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(
	pool StatePool,
	state State,
	model Model,
	modelAgentService ModelAgentService,
	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 {
	MachineCountForBase(base ...state.Base) (map[string]int, error)
	AllMachinesCount() (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(pool StatePool, st State, model Model, modelAgentService ModelAgentService) (*Blocker, error)

Validator returns a blocker.

func ModelValidatorsForControllerModelUpgrade

func ModelValidatorsForControllerModelUpgrade(
	targetVersion version.Number, cloudspec environscloudspec.CloudSpec,
) []Validator

ModelValidatorsForControllerModelUpgrade returns a list of validators for non-controller models in a controller upgrade. Note: the target version can never be lower than the current version.

func ValidatorsForControllerModelUpgrade

func ValidatorsForControllerModelUpgrade(
	targetVersion version.Number, cloudspec environscloudspec.CloudSpec,
) []Validator

ValidatorsForControllerModelUpgrade returns a list of validators for the controller model in a 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