Documentation
¶
Index ¶
Constants ¶
const ( CreatedReason greenhousemetav1alpha1.ConditionReason = "Created" PendingCreationReason greenhousemetav1alpha1.ConditionReason = "PendingCreation" FailingCreationReason greenhousemetav1alpha1.ConditionReason = "FailingCreation" // ScheduledDeletionReason is used to indicate that the resource is scheduled for deletion ScheduledDeletionReason greenhousemetav1alpha1.ConditionReason = "ScheduledDeletion" PendingDeletionReason greenhousemetav1alpha1.ConditionReason = "PendingDeletion" FailingDeletionReason greenhousemetav1alpha1.ConditionReason = "FailingDeletion" DeletedReason greenhousemetav1alpha1.ConditionReason = "Deleted" CommonCleanupFinalizer = "greenhouse.sap/cleanup" // Success should be returned in case the operator reached its target state Success ReconcileResult = "Success" // Failed should be returned in case the operator wasn't able to reach its target state and without external changes it's unlikely that this will succeed in the next try Failed ReconcileResult = "Failed" // Pending should be returned in case the operator is still trying to reach the target state (Requeue, waiting for remote resource to be cleaned up, etc.) Pending ReconcileResult = "Pending" )
Variables ¶
This section is empty.
Functions ¶
func Reconcile ¶
func Reconcile(ctx context.Context, kubeClient client.Client, namespacedName types.NamespacedName, runtimeObject RuntimeObject, reconciler Reconciler, statusFunc Conditioner) (ctrl.Result, error)
Reconcile - is a generic function that is used to reconcile the state of a resource It standardizes the reconciliation loop and provides a common way to set finalizers, remove finalizers, and update the status of the resource It splits the reconciliation into two phases: EnsureCreated and EnsureDeleted to keep the create / update and delete logic in controllers segregated
Types ¶
type Conditioner ¶
type Conditioner func(context.Context, RuntimeObject)
Conditioner is a function that can be used to set the status conditions of the object at a later point in the reconciliation process Provided by the caller of the Reconcile function
type ReconcileResult ¶
type ReconcileResult string
type Reconciler ¶
type Reconciler interface {
EnsureCreated(context.Context, RuntimeObject) (ctrl.Result, ReconcileResult, error)
EnsureDeleted(context.Context, RuntimeObject) (ctrl.Result, ReconcileResult, error)
}
Reconciler is the interface that wraps the basic EnsureCreated and EnsureDeleted methods that a controller should implement
type RuntimeObject ¶
type RuntimeObject interface {
runtime.Object
v1.Object
// GetConditions returns the status conditions of the object (must be implemented in respective types)
GetConditions() greenhousemetav1alpha1.StatusConditions
// SetCondition sets the status conditions of the object (must be implemented in respective types)
SetCondition(greenhousemetav1alpha1.Condition)
}
RuntimeObject is an interface that generalizes the CR object that is being reconciled