reconciler

package
v0.0.0-...-3df9bb7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidationError

func IsValidationError(err error) bool

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
}

StandardRecociler 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, object T, 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, object T, 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 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