ensurer

package
v1.28.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureConfiguration added in v1.28.0

func EnsureConfiguration(ctx context.Context, bootstrap bootstrapObject, strategy EnsureStrategy) error

EnsureConfiguration applies the given maintenance strategy to the given object.

func EnsureConfigurations added in v1.28.0

func EnsureConfigurations(ctx context.Context, boots BootstrapObjects, strategy EnsureStrategy) error

EnsureConfigurations applies the given maintenance strategy to the given objects. At the first error, if any, it stops and returns that error.

func RemoveUnwantedObjects added in v1.28.0

func RemoveUnwantedObjects(ctx context.Context, boots BootstrapObjects) error

RemoveUnwantedObjects attempts to delete the configuration objects that exist, are annotated `apf.kubernetes.io/autoupdate-spec=true`, and do not have a name in the given set. A refusal due to concurrent update is logged and not considered an error; the object will be reconsidered later.

Types

type BootstrapObjects

type BootstrapObjects interface {
	// contains filtered or unexported methods
}

BootstrapObjects is a generic interface to a list of bootstrap objects bound up with the relevant operations on them. The binding makes it unnecessary to have any type casts. A bootstrap object is a mandatory or suggested config object, with the spec that the code is built to provide.

func WrapBootstrapFlowSchemas

WrapBootstrapFlowSchemas creates a generic representation of the given bootstrap objects bound with their operations Every object in `boots` is immutable.

func WrapBootstrapPriorityLevelConfigurations

WrapBootstrapPriorityLevelConfigurations creates a generic representation of the given bootstrap objects bound with their operations. Every object in `boots` is immutable.

type EnsureStrategy added in v1.28.0

type EnsureStrategy interface {
	// Name of the strategy, for now we have two: 'mandatory' and 'suggested'.
	// This comes handy in logging.
	Name() string

	// ShouldUpdate accepts a pair of the current and the bootstrap configuration and determines
	// whether an update is necessary.
	// current is the existing in-cluster configuration object.
	// bootstrap is the configuration the kube-apiserver maintains in-memory.
	//
	// revised: the new object represents the new configuration to be stored in-cluster.
	// ok: true if auto update is required, otherwise false
	// err: err is set when the function runs into an error and can not
	//      determine if auto update is needed.
	ShouldUpdate(wantAndHave) (revised updatable, ok bool, err error)
}

EnsureStrategy provides a maintenance strategy for APF configuration objects. We have two types of strategy, corresponding to the two types of config objetcs:

  • mandatory: the mandatory configurationWrapper objects are about ensuring that the P&F system itself won't crash; we have to be sure there's 'catch-all' place for everything to go. Any changes made by the cluster operators to these configurationWrapper objects will be stomped by the apiserver.

  • suggested: additional configurationWrapper objects for initial behavior. the cluster operators have an option to edit or delete these configurationWrapper objects.

func NewMandatoryEnsureStrategy added in v1.28.0

func NewMandatoryEnsureStrategy() EnsureStrategy

NewMandatoryEnsureStrategy returns an EnsureStrategy for mandatory config objects

func NewSuggestedEnsureStrategy added in v1.28.0

func NewSuggestedEnsureStrategy() EnsureStrategy

NewSuggestedEnsureStrategy returns an EnsureStrategy for suggested config objects

Jump to

Keyboard shortcuts

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