Documentation
¶
Index ¶
- Constants
- func ShortCircuitReconcileFlow(result ReconcileStepResult) bool
- type ReconcileStatusRecorder
- type ReconcileStepFn
- type ReconcileStepResult
- func ContinueReconcile() ReconcileStepResult
- func DoNotRequeue() ReconcileStepResult
- func ReconcileAfter(duration time.Duration, description string) ReconcileStepResult
- func ReconcileWithErrors(description string, errs ...error) ReconcileStepResult
- func RecordErrorAndDoNotRequeue(description string, errs ...error) ReconcileStepResult
- type ReconciledObject
Constants ¶
const ComponentSyncRetryInterval = 5 * time.Second
ComponentSyncRetryInterval is a retry interval with which a reconcile request will be requeued.
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 ReconcileStatusRecorder ¶
type ReconcileStatusRecorder interface {
// RecordStart records the start of a reconcile operation.
RecordStart(ctx context.Context, obj ReconciledObject, operationType grovecorev1alpha1.LastOperationType) error
// RecordCompletion records the completion of a reconcile operation.
// If the last reconciliation completed with errors then it will additionally record <resource>.Status.LastErrors.
RecordCompletion(ctx context.Context, obj ReconciledObject, operationType grovecorev1alpha1.LastOperationType, operationResult *ReconcileStepResult) error
}
ReconcileStatusRecorder is an interface that defines the methods to record the start and completion of a reconcile operation. Reconcile progress will be recorded both as events and as <resource>.Status.LastOperation and <resource>.Status.LastErrors.
func NewReconcileStatusRecorder ¶
func NewReconcileStatusRecorder(client client.Client, eventRecorder record.EventRecorder) ReconcileStatusRecorder
NewReconcileStatusRecorder 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.
type ReconciledObject ¶
type ReconciledObject interface {
client.Object
// SetLastOperation sets the <resource>.Status.LastOperation on the target resource.
SetLastOperation(operation *grovecorev1alpha1.LastOperation)
// 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 ReconcileStatusRecorder will need to have status fields for LastOperation and LastErrors and it should also be a client.Object.