upgradesteps

package
v0.0.0-...-0a82276 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrUpgradeStepsInvalidState is returned when the upgrade state is
	// invalid. We expect it to be in the db completed state, if that's not the
	// case, we can't proceed.
	ErrUpgradeStepsInvalidState = errors.ConstError("invalid upgrade state")

	// ErrFailedUpgradeSteps is returned when either controller fails to
	// complete its upgrade steps.
	ErrFailedUpgradeSteps = errors.ConstError("failed upgrade steps")

	// ErrUpgradeTimeout is returned when the upgrade steps fail to complete
	// within the timeout.
	ErrUpgradeTimeout = errors.ConstError("upgrade timeout")

	// defaultUpgradeTimeout is the default timeout for the upgrade to complete.
	// 10 minutes should be enough for the upgrade steps to complete.
	DefaultUpgradeTimeout = 10 * time.Minute

	DefaultRetryDelay    = 2 * time.Minute
	DefaultRetryAttempts = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APILostDuringUpgrade

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

APILostDuringUpgrade is returned when the API connection is lost during an upgrade.

func NewAPILostDuringUpgrade

func NewAPILostDuringUpgrade(err error) *APILostDuringUpgrade

NewAPILostDuringUpgrade returns a new APILostDuringUpgrade error.

func (*APILostDuringUpgrade) Error

func (e *APILostDuringUpgrade) Error() string

func (*APILostDuringUpgrade) Is

func (e *APILostDuringUpgrade) Is(err error) bool

type BaseWorker

type BaseWorker struct {
	UpgradeCompleteLock gate.Lock
	Agent               agent.Agent
	APICaller           base.APICaller
	StatusSetter        StatusSetter

	PreUpgradeSteps     PreUpgradeStepsFunc
	PerformUpgradeSteps UpgradeStepsFunc

	FromVersion version.Number
	ToVersion   version.Number
	Tag         names.Tag

	Clock  clock.Clock
	Logger logger.Logger
}

BaseWorker defines the common fields and methods used by the machine and controller upgrade workers.

func (*BaseWorker) AlreadyUpgraded

func (w *BaseWorker) AlreadyUpgraded() bool

func (*BaseWorker) RunUpgradeSteps

func (w *BaseWorker) RunUpgradeSteps(ctx context.Context, targets []upgrades.Target) func(agentConfig agent.ConfigSetter) error

runUpgradeSteps runs the required upgrade steps for the agent, retrying on failure. The agent's UpgradedToVersion is set once the upgrade is complete.

This function conforms to the agent.ConfigMutator type and is designed to be called via an agent's ChangeConfig method.

type PreUpgradeStepsFunc

type PreUpgradeStepsFunc = upgrades.PreUpgradeStepsFunc

type StatusSetter

type StatusSetter interface {
	SetStatus(ctx context.Context, setableStatus status.Status, info string, data map[string]any) error
}

StatusSetter defines the single method required to set an agent's status.

type UpgradeStepsFunc

type UpgradeStepsFunc = upgrades.UpgradeStepsFunc

Jump to

Keyboard shortcuts

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