controller

package
v0.0.0-...-2087182 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReconcileHandler

func ReconcileHandler(operations []Operation) (ctrl.Result, error)

ReconcileHandler will invoke all the operations to be performed as part of an object reconcile, managing the queue based on the operations' results.

func SetupControllers

func SetupControllers(mgr manager.Manager, cluster cluster.Cluster, controllers ...Controller) error

SetupControllers invoke the Register function of every controller passed as an argument to this function. If a given Controller implements CacheInitializer, the cache will be initialized before registering the controller.

Types

type CacheInitializer

type CacheInitializer interface {
	SetupCache(mgr ctrl.Manager) error
}

CacheInitializer is an interface that should be implemented by operator controllers requiring to index fields.

type Controller

type Controller interface {
	reconcile.Reconciler

	Register(mgr ctrl.Manager, log *logr.Logger, cluster cluster.Cluster) error
}

Controller is an interface that should be implemented by operator controllers and that allows to have a cohesive way of defining them and register them.

type Operation

type Operation func() (OperationResult, error)

Operation defines the syntax of functions invoked by the ReconcileHandler

type OperationResult

type OperationResult struct {
	RequeueDelay   time.Duration
	RequeueRequest bool
	CancelRequest  bool
}

OperationResult represents the result of a reconcile operation

func ContinueProcessing

func ContinueProcessing() (OperationResult, error)

ContinueProcessing returns an (OperationResult, error) tuple instructing the reconcile loop to continue reconciling of the object.

func Requeue

func Requeue() (OperationResult, error)

Requeue returns an (OperationResult, error) tuple instructing the reconcile loop to requeue the object.

func RequeueAfter

func RequeueAfter(delay time.Duration, err error) (OperationResult, error)

RequeueAfter returns an (OperationResult, error) tuple instructing the reconcile loop to requeue the object after the given delay.

func RequeueOnErrorOrContinue

func RequeueOnErrorOrContinue(err error) (OperationResult, error)

RequeueOnErrorOrContinue returns an (OperationResult, error) tuple instructing the reconcile loop to requeue the object in case of an error or to continue reconciling the object.

func RequeueOnErrorOrStop

func RequeueOnErrorOrStop(err error) (OperationResult, error)

RequeueOnErrorOrStop returns an (OperationResult, error) tuple instructing the reconcile loop to requeue the object in case of an error or to stop reconciling the object.

func RequeueWithError

func RequeueWithError(err error) (OperationResult, error)

RequeueWithError returns an (OperationResult, error) tuple instructing the reconcile loop to requeue the object with the given reconcile error.

func StopProcessing

func StopProcessing() (OperationResult, error)

StopProcessing returns an (OperationResult, error) tuple instructing the reconcile loop to stop reconciling the object.

type ValidationFunction

type ValidationFunction func() *ValidationResult

ValidationFunction defines the signature of validation functions that this validator can invoke.

type ValidationResult

type ValidationResult struct {
	Err   error
	Valid bool
}

ValidationResult is a struct containing whether a validation passed and what was the error in case that it didn't pass.

func Validate

func Validate(functions ...ValidationFunction) *ValidationResult

Validate evaluates all the validation functions passed as an argument and returns a ValidationResult indicating whether the validation passed or not. In case of one of the functions failing the validation, the process will be interrupted and the error will be returned immediately.

Jump to

Keyboard shortcuts

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