Documentation
¶
Overview ¶
Package reconciler provides the Reconcilable interface and the ReconcilerManager, which together form the ordered pipeline that provisions and cleans up the components of a CheCluster custom resource.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reconcilable ¶
type Reconcilable interface {
// Reconcile ensures the actual state of the component matches the desired state
// defined by the CheCluster CR. It is called repeatedly until it reports done,
// so it must tolerate being re-invoked on partially reconciled state.
// Returns:
// - result: reconcile.Result to propagate to the controller, e.g. RequeueAfter
// when the component is not ready yet and must be retried later
// - done: true when the component is fully reconciled; false when it is not ready
// or failed, which stops the pipeline until it is retried
// - err: any error encountered during reconciliation
Reconcile(cheCtx *chetypes.CheContext) (result reconcile.Result, done bool, err error)
// Finalize removes the resources created by the component before the CheCluster CR is deleted.
// It is re-invoked on every reconcile until it succeeds, so it must be idempotent.
// Returns any error encountered during finalization.
Finalize(cheCtx *chetypes.CheContext) (err error)
}
Reconcilable is implemented by every CheCluster component reconciler. Each implementation owns the resources of a single component and is responsible for both provisioning them (Reconcile) and cleaning them up (Finalize).
type ReconcilerManager ¶
type ReconcilerManager struct {
// contains filtered or unexported fields
}
ReconcilerManager executes a collection of Reconcilables as an ordered pipeline. Reconcilers run in registration order, and each one may rely on the components provisioned by the reconcilers registered before it.
func NewReconcilerManager ¶
func NewReconcilerManager() *ReconcilerManager
func (*ReconcilerManager) AddReconciler ¶
func (r *ReconcilerManager) AddReconciler(reconciler Reconcilable)
func (*ReconcilerManager) FinalizeAll ¶
func (r *ReconcilerManager) FinalizeAll(cheCtx *chetypes.CheContext) error
FinalizeAll invokes the Finalize method on all registered reconcilers. Unlike ReconcileAll, it continues executing all finalizers even if one fails, ensuring every cleanup operation has a chance to run. It returns an error combining the errors of all failed finalizers, each wrapped with the reconciler type name; failed finalizers are retried on the next reconciliation attempt, which is safe because Finalize is idempotent.
func (*ReconcilerManager) ReconcileAll ¶
func (r *ReconcilerManager) ReconcileAll(cheCtx *chetypes.CheContext) (reconcile.Result, bool, error)
ReconcileAll reconciles all registered reconcilers in registration order. The pipeline stops at the first reconciler that returns done=false, so that reconcilers depending on earlier components are not run before those are ready.