ensurer

package
v1.29.9 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 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[ObjectType configurationObjectType](ctx context.Context, ops ObjectOps[ObjectType], bootstrap ObjectType, strategy EnsureStrategy[ObjectType]) error

EnsureConfiguration applies the given maintenance strategy to the given object.

func EnsureConfigurations added in v1.28.0

func EnsureConfigurations[ObjectType configurationObjectType](ctx context.Context, ops ObjectOps[ObjectType], boots []ObjectType, strategy EnsureStrategy[ObjectType]) 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[ObjectType configurationObjectType](ctx context.Context, objectOps ObjectOps[ObjectType], boots []ObjectType) 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 EnsureStrategy added in v1.28.0

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

	// ReviseIfNeeded accepts a pair of the current and the bootstrap configuration, determines
	// whether an update is necessary, and returns a (revised if appropriate) copy of the object.
	// 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.
	ReviseIfNeeded(objectOps objectLocalOps[ObjectType], current, bootstrap ObjectType) (revised ObjectType, 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[ObjectType configurationObjectType]() EnsureStrategy[ObjectType]

NewMandatoryEnsureStrategy returns an EnsureStrategy for mandatory config objects

func NewSuggestedEnsureStrategy added in v1.28.0

func NewSuggestedEnsureStrategy[ObjectType configurationObjectType]() EnsureStrategy[ObjectType]

NewSuggestedEnsureStrategy returns an EnsureStrategy for suggested config objects

type ObjectOps added in v1.28.0

type ObjectOps[ObjectType configurationObject] interface {
	// contains filtered or unexported methods
}

ObjectOps is the needed operations, both as a receiver from a server and server-independent, on configurationObjects

func NewObjectOps added in v1.28.0

func NewObjectOps[ObjectType configurationObjectType](client client[ObjectType], cache cache[ObjectType],
	deepCopy func(ObjectType) ObjectType,
	replaceSpec func(ObjectType, ObjectType) ObjectType,
	specEqualish func(expected, actual ObjectType) bool,
) ObjectOps[ObjectType]

Jump to

Keyboard shortcuts

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