Documentation
¶
Index ¶
- func ClassifyObjects[T client.Object](ctx context.Context, c client.Client, expectedObjects []T, currentObjects []T, ...) (creates []T, updates []T, deletes []T, diffStrs []string, err error)
- func CleanupReadLastAppliedAnnotations[T client.Object](ctx context.Context, c client.Client, read MultiPhaseRead[T], ...) (cleaned int)
- func PopulateDiff[T client.Object](diff MultiPhaseDiff[T], creates, updates, deletes []T, diffStrs []string)
- type BasicMultiPhaseReconcilerAction
- func (h *BasicMultiPhaseReconcilerAction[k8sObject]) Configure(ctx context.Context, req reconcile.Request, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *BasicMultiPhaseReconcilerAction[k8sObject]) Delete(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (err error)
- func (h *BasicMultiPhaseReconcilerAction[k8sObject]) OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, ...) (res reconcile.Result, err error)
- func (h *BasicMultiPhaseReconcilerAction[k8sObject]) OnSuccess(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error)
- func (h *BasicMultiPhaseReconcilerAction[k8sObject]) Read(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error)
- type DefaultMultiPhaseDiff
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddDiff(diff string)
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToCreate(o k8sStepObject)
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToDelete(o k8sStepObject)
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToUpdate(o k8sStepObject)
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) Diff() string
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToApply() []k8sStepObject
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToCreate() []k8sStepObject
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToDelete() []k8sStepObject
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToUpdate() []k8sStepObject
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) IsDiff() bool
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) NeedCreate() bool
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) NeedDelete() bool
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) NeedUpdate() bool
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToCreate(objects []k8sStepObject)
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToDelete(objects []k8sStepObject)
- func (h *DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToUpdate(objects []k8sStepObject)
- type DefaultMultiPhaseRead
- func (h *DefaultMultiPhaseRead[k8sStepObject]) AddCurrentObject(o k8sStepObject)
- func (h *DefaultMultiPhaseRead[k8sStepObject]) AddExpectedObject(o k8sStepObject)
- func (h *DefaultMultiPhaseRead[k8sStepObject]) GetCurrentObjects() []k8sStepObject
- func (h *DefaultMultiPhaseRead[k8sStepObject]) GetExpectedObjects() []k8sStepObject
- func (h *DefaultMultiPhaseRead[k8sStepObject]) SetCurrentObjects(objects []k8sStepObject)
- func (h *DefaultMultiPhaseRead[k8sStepObject]) SetExpectedObjects(objects []k8sStepObject)
- type DefaultMultiPhaseReconciler
- type DefaultMultiPhaseStepReconciler
- type DefaultMultiPhaseStepReconcilerAction
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Apply(ctx context.Context, o k8sObject, data map[string]any, objects []k8sStepObject, ...) (res reconcile.Result, err error)
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Configure(ctx context.Context, req reconcile.Request, o k8sObject, logger *logrus.Entry) (res reconcile.Result, err error)
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Delete(ctx context.Context, o k8sObject, data map[string]any, objects []k8sStepObject, ...) (res reconcile.Result, err error)
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObject], ...) (diff MultiPhaseDiff[k8sStepObject], res reconcile.Result, err error)
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) GetPhaseName() shared.PhaseName
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, ...) (res reconcile.Result, err error)
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) OnSuccess(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Read(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (read MultiPhaseRead[k8sStepObject], res reconcile.Result, err error)
- type DefaultMultiPhaseStepReconcilerActionWithDiff
- func (h *DefaultMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObject]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObject], ...) (diff MultiPhaseDiff[k8sStepObject], res reconcile.Result, err error)
- func (h *DefaultMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObject]) OnDiff(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- type MultiPhaseDiff
- type MultiPhaseRead
- type MultiPhaseReconciler
- type MultiPhaseReconcilerAction
- type MultiPhaseStepReconciler
- type MultiPhaseStepReconcilerAction
- func NewMultiPhaseStepReconcilerAction[k8sObject object.MultiPhaseObject, k8sStepObject client.Object](client client.Client, phaseName shared.PhaseName, ...) (...)
- func NewObjectMultiPhaseStepReconcilerAction[k8sObject object.MultiPhaseObject, k8sStepObjectSrc client.Object, ...](in MultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc]) MultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectDst]
- type MultiPhaseStepReconcilerActionWithDiff
- func NewMultiPhaseStepReconcilerActionWithDiff[k8sObject object.MultiPhaseObject, k8sStepObject client.Object](client client.Client, phaseName shared.PhaseName, ...) (...)
- func NewObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject object.MultiPhaseObject, k8sStepObjectSrc client.Object, ...](in MultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc]) MultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectDst]
- type ObjectMultiPhaseDiff
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddDiff(diff string)
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToCreate(o k8sStepObjectDst)
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToDelete(o k8sStepObjectDst)
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToUpdate(o k8sStepObjectDst)
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) Diff() string
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToApply() []k8sStepObjectDst
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToCreate() []k8sStepObjectDst
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToDelete() []k8sStepObjectDst
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToUpdate() []k8sStepObjectDst
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) IsDiff() bool
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedCreate() bool
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedDelete() bool
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedUpdate() bool
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToCreate(objects []k8sStepObjectDst)
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToDelete(objects []k8sStepObjectDst)
- func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToUpdate(objects []k8sStepObjectDst)
- type ObjectMultiPhaseRead
- func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) AddCurrentObject(o k8sStepObjectDst)
- func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) AddExpectedObject(o k8sStepObjectDst)
- func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) GetCurrentObjects() []k8sStepObjectDst
- func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) GetExpectedObjects() []k8sStepObjectDst
- func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) SetCurrentObjects(objects []k8sStepObjectDst)
- func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) SetExpectedObjects(objects []k8sStepObjectDst)
- type ObjectMultiPhaseStepReconcilerAction
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Apply(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Configure(ctx context.Context, req reconcile.Request, o k8sObject, logger *logrus.Entry) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Delete(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObjectDst], ...) (diff MultiPhaseDiff[k8sStepObjectDst], res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) GetPhaseName() shared.PhaseName
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) OnSuccess(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Read(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (read MultiPhaseRead[k8sStepObjectDst], res reconcile.Result, err error)
- type ObjectMultiPhaseStepReconcilerActionWithDiff
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Apply(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Configure(ctx context.Context, req reconcile.Request, o k8sObject, logger *logrus.Entry) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Delete(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObjectDst], ...) (diff MultiPhaseDiff[k8sStepObjectDst], res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) GetPhaseName() shared.PhaseName
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) OnDiff(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) OnSuccess(ctx context.Context, o k8sObject, data map[string]any, ...) (res reconcile.Result, err error)
- func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Read(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (read MultiPhaseRead[k8sStepObjectDst], res reconcile.Result, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClassifyObjects ¶
func ClassifyObjects[T client.Object]( ctx context.Context, c client.Client, expectedObjects []T, currentObjects []T, fieldManager string, dryRun bool, ) (creates []T, updates []T, deletes []T, diffStrs []string, err error)
ClassifyObjects compares expected and current objects, classifying them into create, update, and orphan (delete) lists. When dryRun is enabled, SSA dry-run is used to detect actual changes; unchanged objects are silently skipped.
The algorithm is all-or-nothing: if any dry-run or diff computation fails, all preceding results are discarded and the error is returned. This prevents partial diffs that would cause misapplied resources.
func CleanupReadLastAppliedAnnotations ¶ added in v3.0.2
func CleanupReadLastAppliedAnnotations[T client.Object]( ctx context.Context, c client.Client, read MultiPhaseRead[T], logger *logrus.Entry, ) (cleaned int)
CleanupReadLastAppliedAnnotations removes the legacy kubectl.kubernetes.io/last-applied-configuration annotation from all current objects in read that have a matching expected object (managed children that are not orphans). Orphans are skipped because they are about to be deleted.
Best-effort: per-object cleanup failures are logged at warn level and do not abort the loop or return an error. Returns the number of objects cleaned.
func PopulateDiff ¶
func PopulateDiff[T client.Object](diff MultiPhaseDiff[T], creates, updates, deletes []T, diffStrs []string)
PopulateDiff fills a MultiPhaseDiff from ClassifyObjects results.
Types ¶
type BasicMultiPhaseReconcilerAction ¶
type BasicMultiPhaseReconcilerAction[k8sObject object.MultiPhaseObject] struct { controller.ReconcilerAction }
BasicMultiPhaseReconcilerAction is the default implementation of MultiPhaseReconcilerAction interface
type DefaultMultiPhaseDiff ¶
type DefaultMultiPhaseDiff[k8sStepObject client.Object] struct { // contains filtered or unexported fields }
DefaultMultiPhaseDiff is the default implementation of MultiPhaseDiff interface
func (*DefaultMultiPhaseDiff[k8sStepObject]) AddDiff ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddDiff(diff string)
func (*DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToCreate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToCreate(o k8sStepObject)
func (*DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToDelete ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToDelete(o k8sStepObject)
func (*DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToUpdate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) AddObjectToUpdate(o k8sStepObject)
func (*DefaultMultiPhaseDiff[k8sStepObject]) Diff ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) Diff() string
func (*DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToApply ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToApply() []k8sStepObject
func (*DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToCreate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToCreate() []k8sStepObject
func (*DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToDelete ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToDelete() []k8sStepObject
func (*DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToUpdate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) GetObjectsToUpdate() []k8sStepObject
func (*DefaultMultiPhaseDiff[k8sStepObject]) IsDiff ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) IsDiff() bool
func (*DefaultMultiPhaseDiff[k8sStepObject]) NeedCreate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) NeedCreate() bool
func (*DefaultMultiPhaseDiff[k8sStepObject]) NeedDelete ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) NeedDelete() bool
func (*DefaultMultiPhaseDiff[k8sStepObject]) NeedUpdate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) NeedUpdate() bool
func (*DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToCreate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToCreate(objects []k8sStepObject)
func (*DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToDelete ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToDelete(objects []k8sStepObject)
func (*DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToUpdate ¶
func (h *DefaultMultiPhaseDiff[k8sStepObject]) SetObjectsToUpdate(objects []k8sStepObject)
type DefaultMultiPhaseRead ¶
type DefaultMultiPhaseRead[k8sStepObject client.Object] struct { // contains filtered or unexported fields }
DefaultMultiPhaseRead is the default implementation if MultiPhaseRead
func (*DefaultMultiPhaseRead[k8sStepObject]) AddCurrentObject ¶
func (h *DefaultMultiPhaseRead[k8sStepObject]) AddCurrentObject(o k8sStepObject)
func (*DefaultMultiPhaseRead[k8sStepObject]) AddExpectedObject ¶
func (h *DefaultMultiPhaseRead[k8sStepObject]) AddExpectedObject(o k8sStepObject)
func (*DefaultMultiPhaseRead[k8sStepObject]) GetCurrentObjects ¶
func (h *DefaultMultiPhaseRead[k8sStepObject]) GetCurrentObjects() []k8sStepObject
func (*DefaultMultiPhaseRead[k8sStepObject]) GetExpectedObjects ¶
func (h *DefaultMultiPhaseRead[k8sStepObject]) GetExpectedObjects() []k8sStepObject
func (*DefaultMultiPhaseRead[k8sStepObject]) SetCurrentObjects ¶
func (h *DefaultMultiPhaseRead[k8sStepObject]) SetCurrentObjects(objects []k8sStepObject)
func (*DefaultMultiPhaseRead[k8sStepObject]) SetExpectedObjects ¶
func (h *DefaultMultiPhaseRead[k8sStepObject]) SetExpectedObjects(objects []k8sStepObject)
type DefaultMultiPhaseReconciler ¶
type DefaultMultiPhaseReconciler[k8sObject object.MultiPhaseObject] struct { controller.Reconciler // contains filtered or unexported fields }
DefaultMultiPhaseReconciler is the default multi phase reconsiler you can used when you should to create multiple k8s resources
func (*DefaultMultiPhaseReconciler[k8sObject]) Reconcile ¶
func (h *DefaultMultiPhaseReconciler[k8sObject]) Reconcile(ctx context.Context, req reconcile.Request, o k8sObject, data map[string]interface{}, reconcilerAction MultiPhaseReconcilerAction[k8sObject], reconcilersStepAction ...MultiPhaseStepReconcilerAction[k8sObject, client.Object]) (res reconcile.Result, err error)
type DefaultMultiPhaseStepReconciler ¶
type DefaultMultiPhaseStepReconciler[k8sObject object.MultiPhaseObject, k8sStepObject client.Object] struct { controller.BaseReconciler }
DefaultMultiPhaseStepReconciler is the default implementation of MultiPhaseStepReconciler interface
func (*DefaultMultiPhaseStepReconciler[k8sObject, k8sStepObject]) Reconcile ¶
func (h *DefaultMultiPhaseStepReconciler[k8sObject, k8sStepObject]) Reconcile(ctx context.Context, req reconcile.Request, o k8sObject, data map[string]interface{}, reconcilerAction MultiPhaseStepReconcilerAction[k8sObject, k8sStepObject], logger *logrus.Entry) (res reconcile.Result, err error)
Reconcile permit to reconcile the step (one K8s resource) using Server-Side Apply
type DefaultMultiPhaseStepReconcilerAction ¶
type DefaultMultiPhaseStepReconcilerAction[k8sObject object.MultiPhaseObject, k8sStepObject client.Object] struct { controller.ReconcilerAction // contains filtered or unexported fields }
DefaultMultiPhaseStepReconcilerAction is the default implementation of MultiPhaseStepReconcilerAction (simple variant, always-apply classification).
func (*DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Diff ¶
func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObject], data map[string]any, logger *logrus.Entry) (diff MultiPhaseDiff[k8sStepObject], res reconcile.Result, err error)
func (*DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) GetPhaseName ¶
func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) GetPhaseName() shared.PhaseName
type DefaultMultiPhaseStepReconcilerActionWithDiff ¶ added in v3.0.2
type DefaultMultiPhaseStepReconcilerActionWithDiff[k8sObject object.MultiPhaseObject, k8sStepObject client.Object] struct { *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject] }
DefaultMultiPhaseStepReconcilerActionWithDiff is the default implementation of MultiPhaseStepReconcilerActionWithDiff. It embeds the simple default action, overrides Diff to use SSA dry-run classification, and adds an OnDiff hook that returns nil by default.
func (*DefaultMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObject]) Diff ¶ added in v3.0.2
func (h *DefaultMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObject]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObject], data map[string]any, logger *logrus.Entry) (diff MultiPhaseDiff[k8sStepObject], res reconcile.Result, err error)
type MultiPhaseDiff ¶
type MultiPhaseDiff[k8sStepObject client.Object] interface { NeedCreate() bool NeedUpdate() bool NeedDelete() bool GetObjectsToCreate() []k8sStepObject SetObjectsToCreate(objects []k8sStepObject) AddObjectToCreate(o k8sStepObject) GetObjectsToUpdate() []k8sStepObject SetObjectsToUpdate(objects []k8sStepObject) AddObjectToUpdate(o k8sStepObject) GetObjectsToDelete() []k8sStepObject SetObjectsToDelete(objects []k8sStepObject) AddObjectToDelete(o k8sStepObject) // GetObjectsToApply returns the union of create and update lists for SSA apply. GetObjectsToApply() []k8sStepObject AddDiff(diff string) Diff() string IsDiff() bool }
MultiPhaseDiff is used to know if current resources differ with expected. Objects are classified into create, update, and delete lists.
func NewMultiPhaseDiff ¶
func NewMultiPhaseDiff[k8sStepObject client.Object]() MultiPhaseDiff[k8sStepObject]
NewMultiPhaseDiff is the default implementation of MultiPhaseDiff interface
func NewObjectMultiphaseDiff ¶
func NewObjectMultiphaseDiff[k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object](in MultiPhaseDiff[k8sStepObjectSrc]) MultiPhaseDiff[k8sStepObjectDst]
type MultiPhaseRead ¶
type MultiPhaseRead[k8sStepObject client.Object] interface { // GetCurrentObjects permit to get the list of current objects GetCurrentObjects() []k8sStepObject // SetCurrentObjects permit to set the list of current objects SetCurrentObjects(objects []k8sStepObject) // AddCurrentObject will add object on the list of current objects AddCurrentObject(o k8sStepObject) // GetExpectedObjects permit to get the list of expected objects GetExpectedObjects() []k8sStepObject // SetExpectedObjects permit to set the list of expected objects SetExpectedObjects(objects []k8sStepObject) // AddExpectedObject will add object on the list of expected objects AddExpectedObject(o k8sStepObject) }
MultiPhaseRead is the interface to store the result of read step on multi phase reconciler
func NewMultiPhaseRead ¶
func NewMultiPhaseRead[k8sStepObject client.Object]() MultiPhaseRead[k8sStepObject]
NewMultiPhaseRead is the default implementation of MultiPhaseRead interface
func NewObjectMultiphaseRead ¶
func NewObjectMultiphaseRead[k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object](in MultiPhaseRead[k8sStepObjectSrc]) MultiPhaseRead[k8sStepObjectDst]
type MultiPhaseReconciler ¶
type MultiPhaseReconciler[k8sObject object.MultiPhaseObject] interface { controller.Reconciler // Reconcile permit to orchestrate all phase needed to successfully reconcile the object Reconcile(ctx context.Context, req reconcile.Request, o k8sObject, data map[string]interface{}, reconcilerAction MultiPhaseReconcilerAction[k8sObject], reconcilersStepAction ...MultiPhaseStepReconcilerAction[k8sObject, client.Object]) (res reconcile.Result, err error) }
MultiPhaseReconciler the reconciler to implement whe you need to create multiple resources on k8s
func NewMultiPhaseReconciler ¶
func NewMultiPhaseReconciler[k8sObject object.MultiPhaseObject](c client.Client, name string, finalizer shared.FinalizerName, logger *logrus.Entry, recorder record.EventRecorder) (multiPhaseReconciler MultiPhaseReconciler[k8sObject])
NewMultiPhaseReconciler is the default implementation of MultiPhaseReconciler
type MultiPhaseReconcilerAction ¶
type MultiPhaseReconcilerAction[k8sObject object.MultiPhaseObject] interface { controller.ReconcilerAction // Configure permit to init condition on status Configure(ctx context.Context, req reconcile.Request, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error) // Read permit to read kubernetes resources Read(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error) // Delete permit to delete resources on kubernetes Delete(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (err error) // OnError is call when error is throwing on current phase // It the right way to set status condition when error OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, logger *logrus.Entry) (res reconcile.Result, err error) // OnSuccess is call at the end of current phase, if not error // It's the right way to set status condition when everithink is good OnSuccess(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error) }
MultiPhaseReconcilerAction is the methode needed by step reconciler to reconcile your custom resource
func NewMultiPhaseReconcilerAction ¶
func NewMultiPhaseReconcilerAction[k8sObject object.MultiPhaseObject](client client.Client, conditionName shared.ConditionName, recorder record.EventRecorder) (multiPhaseReconciler MultiPhaseReconcilerAction[k8sObject])
NewMultiPhaseReconcilerAction is the default implementation of MultiPhaseReconcilerAction interface
type MultiPhaseStepReconciler ¶
type MultiPhaseStepReconciler[k8sObject object.MultiPhaseObject, k8sStepObject client.Object] interface { controller.BaseReconciler // Reconcile permit to reconcile the step (one K8s resource) Reconcile(ctx context.Context, req reconcile.Request, o k8sObject, data map[string]interface{}, reconciler MultiPhaseStepReconcilerAction[k8sObject, k8sStepObject], logger *logrus.Entry) (res reconcile.Result, err error) }
MultiPhaseStepReconciler is the reconciler to implement to create one step for MultiPhaseReconciler
func NewMultiPhaseStepReconciler ¶
func NewMultiPhaseStepReconciler[k8sObject object.MultiPhaseObject, k8sStepObject client.Object](client client.Client, logger *logrus.Entry, recorder record.EventRecorder) (multiPhaseStepReconciler MultiPhaseStepReconciler[k8sObject, k8sStepObject])
NewMultiPhaseStepReconciler is the default implementation of MultiPhaseStepReconciler interface
type MultiPhaseStepReconcilerAction ¶
type MultiPhaseStepReconcilerAction[k8sObject object.MultiPhaseObject, k8sStepObject client.Object] interface { controller.ReconcilerAction // Configure permit to init condition on status Configure(ctx context.Context, req reconcile.Request, o k8sObject, logger *logrus.Entry) (res reconcile.Result, err error) // Read permit to read kubernetes resources Read(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (read MultiPhaseRead[k8sStepObject], res reconcile.Result, err error) // Apply permit to apply resources on kubernetes using Server-Side Apply Apply(ctx context.Context, o k8sObject, data map[string]any, objects []k8sStepObject, logger *logrus.Entry) (res reconcile.Result, err error) // Delete permit to delete resources on kubernetes Delete(ctx context.Context, o k8sObject, data map[string]any, objects []k8sStepObject, logger *logrus.Entry) (res reconcile.Result, err error) // OnError is call when error is throwing on current phase // It the right way to set status condition when error OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, logger *logrus.Entry) (res reconcile.Result, err error) // OnSuccess is call at the end of current phase, if not error // It's the right way to set status condition when everything is good OnSuccess(ctx context.Context, o k8sObject, data map[string]any, diff MultiPhaseDiff[k8sStepObject], logger *logrus.Entry) (res reconcile.Result, err error) // Diff permit to compare the actual state and the expected state. // The simple variant always uses always-apply classification: all expected objects // with current counterparts go to the update list (legacy always-apply). Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObject], data map[string]any, logger *logrus.Entry) (diff MultiPhaseDiff[k8sStepObject], res reconcile.Result, err error) // GetPhaseName permit to get the phase name GetPhaseName() shared.PhaseName }
MultiPhaseStepReconcilerAction is the interface that use by reconciler step to reconcile your intermediate K8s resources It uses Server-Side Apply (SSA) to manage child resources. This is the simple variant: it has no OnDiff hook and Diff always uses always-apply classification (all expected objects with current counterparts are applied).
func NewMultiPhaseStepReconcilerAction ¶
func NewMultiPhaseStepReconcilerAction[k8sObject object.MultiPhaseObject, k8sStepObject client.Object](client client.Client, phaseName shared.PhaseName, conditionName shared.ConditionName, recorder record.EventRecorder, fieldManager string) (multiPhaseStepReconciler MultiPhaseStepReconcilerAction[k8sObject, k8sStepObject])
NewMultiPhaseStepReconcilerAction creates a new step reconciler action using Server-Side Apply. The fieldManager parameter identifies this controller as the owner of the fields it manages. This is the simple variant: Diff always uses always-apply classification and no OnDiff hook is available.
func NewObjectMultiPhaseStepReconcilerAction ¶
func NewObjectMultiPhaseStepReconcilerAction[k8sObject object.MultiPhaseObject, k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object](in MultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc]) MultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectDst]
type MultiPhaseStepReconcilerActionWithDiff ¶ added in v3.0.2
type MultiPhaseStepReconcilerActionWithDiff[k8sObject object.MultiPhaseObject, k8sStepObject client.Object] interface { MultiPhaseStepReconcilerAction[k8sObject, k8sStepObject] // OnDiff is called between Diff and Apply, after the diff has been computed. // The diff variant always uses SSA dry-run classification. The default implementation // returns nil (safe no-op); override it to run pre-apply tasks (e.g. drain before // StatefulSet update). OnDiff(ctx context.Context, o k8sObject, data map[string]any, diff MultiPhaseDiff[k8sStepObject], logger *logrus.Entry) (res reconcile.Result, err error) }
MultiPhaseStepReconcilerActionWithDiff is the diff variant of MultiPhaseStepReconcilerAction. It embeds the base interface and adds OnDiff. Diff always uses SSA dry-run classification, so diff.NeedUpdate() / diff.GetObjectsToUpdate() are reliable in OnDiff.
func NewMultiPhaseStepReconcilerActionWithDiff ¶ added in v3.0.2
func NewMultiPhaseStepReconcilerActionWithDiff[k8sObject object.MultiPhaseObject, k8sStepObject client.Object](client client.Client, phaseName shared.PhaseName, conditionName shared.ConditionName, recorder record.EventRecorder, fieldManager string) (multiPhaseStepReconciler MultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObject])
NewMultiPhaseStepReconcilerActionWithDiff creates a new step reconciler action using Server-Side Apply. The fieldManager parameter identifies this controller as the owner of the fields it manages. This is the diff variant: Diff always uses SSA dry-run classification and OnDiff defaults to a safe no-op.
func NewObjectMultiPhaseStepReconcilerActionWithDiff ¶ added in v3.0.2
func NewObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject object.MultiPhaseObject, k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object](in MultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc]) MultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectDst]
type ObjectMultiPhaseDiff ¶
type ObjectMultiPhaseDiff[k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object] struct { // contains filtered or unexported fields }
ObjectMultiPhaseDiff wraps MultiPhaseDiff[k8sStepObjectSrc] -> MultiPhaseDiff[k8sStepObjectDst]
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddDiff ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddDiff(diff string)
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToCreate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToCreate(o k8sStepObjectDst)
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToDelete ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToDelete(o k8sStepObjectDst)
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToUpdate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) AddObjectToUpdate(o k8sStepObjectDst)
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) Diff ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) Diff() string
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToApply ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToApply() []k8sStepObjectDst
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToCreate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToCreate() []k8sStepObjectDst
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToDelete ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToDelete() []k8sStepObjectDst
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToUpdate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) GetObjectsToUpdate() []k8sStepObjectDst
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) IsDiff ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) IsDiff() bool
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedCreate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedCreate() bool
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedDelete ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedDelete() bool
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedUpdate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) NeedUpdate() bool
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToCreate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToCreate(objects []k8sStepObjectDst)
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToDelete ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToDelete(objects []k8sStepObjectDst)
func (*ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToUpdate ¶
func (h *ObjectMultiPhaseDiff[k8sStepObjectSrc, k8sStepObjectDst]) SetObjectsToUpdate(objects []k8sStepObjectDst)
type ObjectMultiPhaseRead ¶
type ObjectMultiPhaseRead[k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object] struct { // contains filtered or unexported fields }
ObjectMultiPhaseRead is the implementation of MultiPhaseRead for a specific client.Object type needed by multiphase reconciler It's kind of wrapper to conver MultiPhaseRead[k8sStepObject] to MultiPhaseRead[client.Object]
func (*ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) AddCurrentObject ¶
func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) AddCurrentObject(o k8sStepObjectDst)
func (*ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) AddExpectedObject ¶
func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) AddExpectedObject(o k8sStepObjectDst)
func (*ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) GetCurrentObjects ¶
func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) GetCurrentObjects() []k8sStepObjectDst
func (*ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) GetExpectedObjects ¶
func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) GetExpectedObjects() []k8sStepObjectDst
func (*ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) SetCurrentObjects ¶
func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) SetCurrentObjects(objects []k8sStepObjectDst)
func (*ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) SetExpectedObjects ¶
func (h *ObjectMultiPhaseRead[k8sStepObjectSrc, k8sStepObjectDst]) SetExpectedObjects(objects []k8sStepObjectDst)
type ObjectMultiPhaseStepReconcilerAction ¶
type ObjectMultiPhaseStepReconcilerAction[k8sObject object.MultiPhaseObject, k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object] struct { controller.ReconcilerAction // contains filtered or unexported fields }
ObjectMultiPhaseStepReconcilerAction is the implementation of MultiPhaseStepReconcilerAction for a specific client.Object type needed by multiphase reconciler It's kind of wrapper to convert MultiPhaseStepReconcilerAction[k8sStepObject] to MultiPhaseStepReconcilerAction[client.Object]
func (*ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Configure ¶
func (*ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Delete ¶
func (*ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Diff ¶
func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObjectDst], data map[string]any, logger *logrus.Entry) (diff MultiPhaseDiff[k8sStepObjectDst], res reconcile.Result, err error)
func (*ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) GetPhaseName ¶
func (h *ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) GetPhaseName() shared.PhaseName
func (*ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) OnError ¶
func (*ObjectMultiPhaseStepReconcilerAction[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) OnSuccess ¶
type ObjectMultiPhaseStepReconcilerActionWithDiff ¶ added in v3.0.2
type ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject object.MultiPhaseObject, k8sStepObjectSrc client.Object, k8sStepObjectDst client.Object] struct { controller.ReconcilerAction // contains filtered or unexported fields }
ObjectMultiPhaseStepReconcilerActionWithDiff is the diff-variant implementation of the object wrapper. It wraps a MultiPhaseStepReconcilerActionWithDiff[src] into a MultiPhaseStepReconcilerActionWithDiff[dst] and forwards OnDiff to the inner action.
func (*ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Apply ¶ added in v3.0.2
func (*ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Configure ¶ added in v3.0.2
func (*ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Delete ¶ added in v3.0.2
func (*ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Diff ¶ added in v3.0.2
func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) Diff(ctx context.Context, o k8sObject, read MultiPhaseRead[k8sStepObjectDst], data map[string]any, logger *logrus.Entry) (diff MultiPhaseDiff[k8sStepObjectDst], res reconcile.Result, err error)
func (*ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) GetPhaseName ¶ added in v3.0.2
func (h *ObjectMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObjectSrc, k8sStepObjectDst]) GetPhaseName() shared.PhaseName