upgrades

package
v0.0.0-...-56cb166 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package upgrades provides infrastructure to upgrade previous Juju deployments to the current Juju version. The upgrade is performed on a per node basis, across all of the running Juju machines.

Important exported APIs include:

PerformUpgrade, which is invoked on each node by the machine agent with:
  fromVersion - the Juju version from which the upgrade is occurring
  target      - the type of Juju node being upgraded
  context     - provides API access to Juju controllers

Index

Constants

View Source
const (
	// AllMachines applies to any machine.
	AllMachines = Target("allMachines")

	// HostMachine is a machine on which units are deployed.
	HostMachine = Target("hostMachine")

	// Controller is a machine participating in a Juju controller cluster.
	Controller = Target("controller")

	// DatabaseMaster is a Controller that has the master database, and as such
	// is the only target that should run database schema upgrade steps.
	DatabaseMaster = Target("databaseMaster")
)

Variables

View Source
var MinDiskSpaceMib = uint64(250)

MinDiskSpaceMib is the standard amount of disk space free (in MiB) we'll require before downloading a binary or starting an upgrade.

Functions

func CheckFreeDiskSpace

func CheckFreeDiskSpace(dir string, thresholdMib uint64) error

CheckFreeDiskSpace returns a helpful error if there isn't at least thresholdMib MiB of free space available on the volume containing dir.

func PerformUpgradeSteps

func PerformUpgradeSteps(from version.Number, targets []Target, context Context) error

PerformUpgradeSteps runs the business logic needed to upgrade the current "from" version to this version of Juju on the "target" type of machine.

func PreUpgradeSteps

func PreUpgradeSteps(agentConf agent.Config, isController bool) error

PreUpgradeSteps runs various checks and prepares for performing an upgrade. If any check fails, an error is returned which aborts the upgrade.

func PreUpgradeStepsCAAS

func PreUpgradeStepsCAAS(agentConf agent.Config, isController bool) error

PreUpgradeStepsCAAS runs various checks for CAAS and prepares for performing an upgrade. If any check fails, an error is returned which aborts the upgrade.

Types

type Context

type Context interface {
	// APIState returns an base APICaller to help make
	// an API connection to state.
	APIState() base.APICaller

	// AgentConfig returns the agent config for the machine that is being
	// upgraded.
	AgentConfig() agent.ConfigSetter

	// APIContext returns a new Context suitable for API-based upgrade
	// steps.
	APIContext() Context
}

Context provides the dependencies used when executing upgrade steps.

func NewContext

func NewContext(
	agentConfig agent.ConfigSetter,
	apiCaller base.APICaller,
) Context

NewContext returns a new upgrade context.

type Model

type Model interface {
	Config() (*config.Config, error)
	CloudSpec() (environscloudspec.CloudSpec, error)
}

Model is an interface providing access to the details of a model within the controller.

type Operation

type Operation interface {
	// TargetVersion is the Juju version for which this operation is applicable.
	// Upgrade operations designed for versions of Juju earlier
	// than we are upgrading from are not run since such steps would
	// already have been used to get to the version we are running now.
	TargetVersion() version.Number

	// Steps to perform during an upgrade.
	Steps() []Step
}

Operation defines what steps to perform to upgrade to a target version.

type OperationSource

type OperationSource interface {
	// UpgradeOperations returns Operations to run during upgrade.
	UpgradeOperations() []Operation
}

OperationSource provides a means of obtaining upgrade operations.

type PreUpgradeStepsFunc

type PreUpgradeStepsFunc func(_ agent.Config, isController bool) error

PreUpgradeStepsFunc is the function type of PreUpgradeSteps. This may be used to provide an alternative to PreUpgradeSteps to the upgrade steps worker.

type Step

type Step interface {
	// Description is a human readable description of what the upgrade step does.
	Description() string

	// Targets returns the target machine types for which the upgrade step is applicable.
	Targets() []Target

	// Run executes the upgrade business logic.
	Run(Context) error
}

Step defines an idempotent operation that is run to perform a specific upgrade step.

type Target

type Target string

Target defines the type of machine for which a particular upgrade step can be run.

type UpgradeStepsFunc

type UpgradeStepsFunc func(from version.Number, targets []Target, context Context) error

UpgradeStepsFunc is the function type of Upgrade. This may be used to provide an alternative to Upgrade to the upgrade steps worker.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
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