reconciler

package
v0.0.0-...-c888339 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTransientError

func IsTransientError(err error) bool

func IsValidationError

func IsValidationError(err error) bool

func NewTransientError

func NewTransientError(message string) error

func NewValidationError

func NewValidationError(message string) error

Types

type FinalizeFunc

type FinalizeFunc[T client.Object] func(ctx context.Context, obj T) error

FinalizeFunc is a function that finalizes an object. It does not remove the finalizer.

type ReconcileFunc

type ReconcileFunc[T client.Object] func(ctx context.Context, obj T) (ctrl.Result, error)

ReconcileFunc is a function that reconciles an object.

type StandardReconciler

type StandardReconciler[T client.Object] struct {
	// contains filtered or unexported fields
}

StandardReconciler encapsulates common reconciler behavior, allowing you to implement a reconciler simply by providing a ReconcileFunc and an optional FinalizeFunc. These functions are invoked at the appropriate time and are passed the object being reconciled.

func NewStandardReconciler

func NewStandardReconciler[T client.Object](cl client.Client, reconcileFunc ReconcileFunc[T]) *StandardReconciler[T]

NewStandardReconciler creates a new StandardReconciler for objects of the specified type.

func NewStandardReconcilerWithFinalizer

func NewStandardReconcilerWithFinalizer[T client.Object](
	cl client.Client, reconcileFunc ReconcileFunc[T], finalizeFunc FinalizeFunc[T], finalizer string,
) *StandardReconciler[T]

NewStandardReconcilerWithFinalizer is similar to NewStandardReconciler, but also accepts a finalizer and a FinalizerFunc.

func (*StandardReconciler[T]) Reconcile

func (r *StandardReconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile reconciles the object. It first fetches the object from the client, then invokes the configured ReconcileFunc. If a finalizer is configured in the reconciler, and the object is new, this function adds the finalizer to the object. When the object is being deleted, this function invokes the configured FinalizerFunc and removes the finalizer afterward.

type TransientError

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

TransientError is an error returned by a Reconciler that will usually resolve itself when retrying, e.g. some resource not yet reconciled

func (TransientError) Error

func (v TransientError) Error() string

type ValidationError

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

func (ValidationError) Error

func (v ValidationError) Error() string

Jump to

Keyboard shortcuts

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