common

package
v0.1.0-alpha.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShortCircuitReconcileFlow

func ShortCircuitReconcileFlow(result ReconcileStepResult) bool

ShortCircuitReconcileFlow returns true if the reconcile flow should be short-circuited and not continue.

Types

type ReconcileErrorRecorder

type ReconcileErrorRecorder interface {
	// RecordErrors records errors encountered during a reconcile run.
	RecordErrors(ctx context.Context, obj ReconciledObject, result *ReconcileStepResult) error
}

ReconcileErrorRecorder is an interface that records errors during a reconciliation into <resource>.Status.LastErrors.

func NewReconcileErrorRecorder

func NewReconcileErrorRecorder(client client.Client) ReconcileErrorRecorder

NewReconcileErrorRecorder returns a new reconcile status recorder.

type ReconcileStepFn

type ReconcileStepFn[T component.GroveCustomResourceType] func(ctx context.Context, log logr.Logger, obj *T) ReconcileStepResult

ReconcileStepFn is a function that performs a step in the reconcile flow.

type ReconcileStepResult

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

ReconcileStepResult holds the result of a reconcile step.

func ContinueReconcile

func ContinueReconcile() ReconcileStepResult

ContinueReconcile returns a ReconcileStepResult that continues the reconciliation to the next step.

func DoNotRequeue

func DoNotRequeue() ReconcileStepResult

DoNotRequeue returns a ReconcileStepResult that does not requeue the reconciliation.

func ReconcileAfter

func ReconcileAfter(duration time.Duration, description string) ReconcileStepResult

ReconcileAfter returns a ReconcileStepResult that re-queues the reconciliation after the given duration.

func ReconcileWithErrors

func ReconcileWithErrors(description string, errs ...error) ReconcileStepResult

ReconcileWithErrors returns a ReconcileStepResult that re-queues the reconciliation with the given errors.

func RecordErrorAndDoNotRequeue

func RecordErrorAndDoNotRequeue(description string, errs ...error) ReconcileStepResult

RecordErrorAndDoNotRequeue returns a ReconcileStepResult that records the error and does not requeue the reconciliation.

func (ReconcileStepResult) GetDescription

func (r ReconcileStepResult) GetDescription() string

GetDescription returns the description from the reconcile step.

func (ReconcileStepResult) GetErrors

func (r ReconcileStepResult) GetErrors() []error

GetErrors returns the errors from the reconcile step.

func (ReconcileStepResult) HasErrors

func (r ReconcileStepResult) HasErrors() bool

HasErrors returns true if there are errors from the reconcile step.

func (ReconcileStepResult) NeedsRequeue

func (r ReconcileStepResult) NeedsRequeue() bool

NeedsRequeue returns true if the reconcile step needs to be requeued. This will happen if there is an error or if the result is marked to be requeued.

func (ReconcileStepResult) Result

func (r ReconcileStepResult) Result() (ctrl.Result, error)

Result returns the result and error from the reconcile step.

type ReconciledObject

type ReconciledObject interface {
	client.Object
	// SetLastErrors sets the <resource>.Status.LastErrors on the target resource.
	SetLastErrors(lastErrors ...grovecorev1alpha1.LastError)
}

ReconciledObject is an interface that defines the methods to track the status of a resource during reconciliation. It is expected that any resource that wishes to use the ReconcileErrorRecorder will need to have status fields for LastErrors, and it should also be a client.Object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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