multiphase

package
v3.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

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

func (*BasicMultiPhaseReconcilerAction[k8sObject]) Configure

func (h *BasicMultiPhaseReconcilerAction[k8sObject]) Configure(ctx context.Context, req reconcile.Request, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error)

func (*BasicMultiPhaseReconcilerAction[k8sObject]) Delete

func (h *BasicMultiPhaseReconcilerAction[k8sObject]) Delete(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (err error)

func (*BasicMultiPhaseReconcilerAction[k8sObject]) OnError

func (h *BasicMultiPhaseReconcilerAction[k8sObject]) OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, logger *logrus.Entry) (res reconcile.Result, err error)

func (*BasicMultiPhaseReconcilerAction[k8sObject]) OnSuccess

func (h *BasicMultiPhaseReconcilerAction[k8sObject]) OnSuccess(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error)

func (*BasicMultiPhaseReconcilerAction[k8sObject]) Read

func (h *BasicMultiPhaseReconcilerAction[k8sObject]) Read(ctx context.Context, o k8sObject, data map[string]any, logger *logrus.Entry) (res reconcile.Result, err error)

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[S]) As added in v3.0.8

As converts this diff container to expose a different client.Object subtype D.

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[S]) As added in v3.0.8

As converts this read container to expose a different client.Object subtype D. The conversion is identity-based (all client.Object subtypes share the same underlying interface); it is provided as a method for ergonomics so callers don't need to construct the wrapper type manually.

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]) Apply

func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Apply(ctx context.Context, o k8sObject, data map[string]any, objects []k8sStepObject, logger *logrus.Entry) (res reconcile.Result, err error)

func (*DefaultMultiPhaseStepReconcilerAction[K, S]) As added in v3.0.8

As converts this step action to operate on a different client.Object subtype D.

func (*DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Configure

func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Configure(ctx context.Context, req reconcile.Request, o k8sObject, logger *logrus.Entry) (res reconcile.Result, err error)

func (*DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Delete

func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Delete(ctx context.Context, o k8sObject, data map[string]any, objects []k8sStepObject, logger *logrus.Entry) (res reconcile.Result, err error)

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

func (*DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) OnError

func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) OnError(ctx context.Context, o k8sObject, data map[string]any, currentErr error, logger *logrus.Entry) (res reconcile.Result, err error)

func (*DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) OnSuccess

func (h *DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) OnSuccess(ctx context.Context, o k8sObject, data map[string]any, diff MultiPhaseDiff[k8sStepObject], logger *logrus.Entry) (res reconcile.Result, err error)

func (*DefaultMultiPhaseStepReconcilerAction[k8sObject, k8sStepObject]) Read

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 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[K, S]) AsWithDiff added in v3.0.8

AsWithDiff converts this diff-variant step action to operate on a different client.Object subtype D.

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)

func (*DefaultMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObject]) OnDiff added in v3.0.2

func (h *DefaultMultiPhaseStepReconcilerActionWithDiff[k8sObject, k8sStepObject]) OnDiff(ctx context.Context, o k8sObject, data map[string]any, diff MultiPhaseDiff[k8sStepObject], logger *logrus.Entry) (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 DiffAs added in v3.0.8

func DiffAs[S, D client.Object](in MultiPhaseDiff[S]) MultiPhaseDiff[D]

DiffAs converts any MultiPhaseDiff[S] to expose client.Object subtype D. It prefers the efficient .As[D]() generic method when the underlying type is *DefaultMultiPhaseDiff, falling back to a wrapper for custom implementations.

This is the non-deprecated equivalent of NewObjectMultiphaseDiff.

func NewMultiPhaseDiff

func NewMultiPhaseDiff[k8sStepObject client.Object]() MultiPhaseDiff[k8sStepObject]

NewMultiPhaseDiff is the default implementation of MultiPhaseDiff interface

func NewObjectMultiphaseDiff deprecated

func NewObjectMultiphaseDiff[Src, Dst client.Object](in MultiPhaseDiff[Src]) MultiPhaseDiff[Dst]

Deprecated: Use DiffAs[S, D](in) instead.

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 deprecated

func NewObjectMultiphaseRead[Src, Dst client.Object](in MultiPhaseRead[Src]) MultiPhaseRead[Dst]

Deprecated: Use ReadAs[S, D](in) instead.

func ReadAs added in v3.0.8

func ReadAs[S, D client.Object](in MultiPhaseRead[S]) MultiPhaseRead[D]

ReadAs converts any MultiPhaseRead[S] to expose client.Object subtype D. It prefers the efficient .As[D]() generic method when the underlying type is *DefaultMultiPhaseRead, falling back to a wrapper for custom implementations.

This is the non-deprecated equivalent of NewObjectMultiphaseRead.

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 As added in v3.0.8

As converts any MultiPhaseStepReconcilerAction[K, S] to operate on client.Object subtype D. It prefers the efficient .As[D]() generic method when the underlying type is *DefaultMultiPhaseStepReconcilerAction, falling back to a wrapper for custom implementations.

This is the non-deprecated equivalent of NewObjectMultiPhaseStepReconcilerAction.

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 deprecated

func NewObjectMultiPhaseStepReconcilerAction[K object.MultiPhaseObject, S, D client.Object](in MultiPhaseStepReconcilerAction[K, S]) MultiPhaseStepReconcilerAction[K, D]

Deprecated: Use As[K, S, D](in) instead.

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 AsWithDiff added in v3.0.8

AsWithDiff converts any MultiPhaseStepReconcilerActionWithDiff[K, S] to operate on client.Object subtype D. It prefers the efficient .AsWithDiff[D]() generic method when the underlying type is *DefaultMultiPhaseStepReconcilerActionWithDiff, falling back to a wrapper for custom implementations.

This is the non-deprecated equivalent of NewObjectMultiPhaseStepReconcilerActionWithDiff.

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 deprecated added in v3.0.2

func NewObjectMultiPhaseStepReconcilerActionWithDiff[K object.MultiPhaseObject, S, D client.Object](in MultiPhaseStepReconcilerActionWithDiff[K, S]) MultiPhaseStepReconcilerActionWithDiff[K, D]

Deprecated: Use AsWithDiff[K, S, D](in) instead.

type ObjectMultiPhaseDiff deprecated

type ObjectMultiPhaseDiff[Src, Dst client.Object] = objectMultiPhaseDiff[Src, Dst]

Deprecated: Use DefaultMultiPhaseDiff.As[D]() instead.

type ObjectMultiPhaseRead deprecated

type ObjectMultiPhaseRead[Src, Dst client.Object] = objectMultiPhaseRead[Src, Dst]

Deprecated: Use DefaultMultiPhaseRead.As[D]() instead.

type ObjectMultiPhaseStepReconcilerAction deprecated

type ObjectMultiPhaseStepReconcilerAction[K object.MultiPhaseObject, S, D client.Object] = objectMultiPhaseStepReconcilerAction[K, S, D]

Deprecated: Use DefaultMultiPhaseStepReconcilerAction.As[D]() instead.

type ObjectMultiPhaseStepReconcilerActionWithDiff deprecated added in v3.0.2

type ObjectMultiPhaseStepReconcilerActionWithDiff[K object.MultiPhaseObject, S, D client.Object] = objectMultiPhaseStepReconcilerActionWithDiff[K, S, D]

Deprecated: Use DefaultMultiPhaseStepReconcilerActionWithDiff.AsWithDiff[D]() instead.

Jump to

Keyboard shortcuts

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