Documentation
¶
Index ¶
- type Action
- type ConditionManager
- type ErrorInfo
- type ErrorReporter
- type Lifecycle
- func (l *Lifecycle) Reconcile(ctx context.Context, req mcreconcile.Request) (reconcile.Result, error)
- func (l *Lifecycle) WithConditions(cm ConditionManager) *Lifecycle
- func (l *Lifecycle) WithErrorReporters(reporters ...ErrorReporter) *Lifecycle
- func (l *Lifecycle) WithInitializer(name string) *Lifecycle
- func (l *Lifecycle) WithPrepareContext(fn func(ctx context.Context, obj client.Object) (context.Context, error)) *Lifecycle
- func (l *Lifecycle) WithReadOnly() *Lifecycle
- func (l *Lifecycle) WithSpecPatch() *Lifecycle
- func (l *Lifecycle) WithSpread(sm SpreadManager) *Lifecycle
- func (l *Lifecycle) WithTerminator(name string) *Lifecycle
- type SpreadManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
Action represents the type of operation a subroutine performs.
func (Action) IsFinalize ¶
IsFinalize returns true if the action is a finalize or terminate operation.
type ConditionManager ¶
type ConditionManager interface {
InitUnknownConditions(obj client.Object, subroutineNames []string)
SetSubroutineCondition(obj client.Object, name string, result subroutines.Result, err error, isFinalize bool)
SetSkippedConditions(obj client.Object, names []string, ready bool, msg string)
SetReadyCondition(obj client.Object, reason string)
}
ConditionManager manages per-subroutine and aggregate conditions.
type ErrorReporter ¶
ErrorReporter is called when a subroutine returns an error.
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle orchestrates subroutine execution for a Kubernetes controller.
func New ¶
func New(mgr mcmanager.Manager, controllerName string, newObj func() client.Object, subs ...subroutines.Subroutine) *Lifecycle
New creates a Lifecycle for the given controller.
func (*Lifecycle) Reconcile ¶
func (l *Lifecycle) Reconcile(ctx context.Context, req mcreconcile.Request) (reconcile.Result, error)
Reconcile implements mcreconcile.Reconciler.
func (*Lifecycle) WithConditions ¶
func (l *Lifecycle) WithConditions(cm ConditionManager) *Lifecycle
WithConditions enables condition management. Panics if the object produced by newObj does not implement conditions.ConditionAccessor.
func (*Lifecycle) WithErrorReporters ¶
func (l *Lifecycle) WithErrorReporters(reporters ...ErrorReporter) *Lifecycle
WithErrorReporters adds one or more error reporters.
func (*Lifecycle) WithInitializer ¶
WithInitializer enables initializer support. When the given name is present in status.initializers (set by kcp), subroutines implementing Initializer will run Initialize instead of Process. The marker is removed from status once all subroutines complete successfully.
func (*Lifecycle) WithPrepareContext ¶
func (l *Lifecycle) WithPrepareContext(fn func(ctx context.Context, obj client.Object) (context.Context, error)) *Lifecycle
WithPrepareContext sets a function to enrich the context before subroutines run.
func (*Lifecycle) WithReadOnly ¶
WithReadOnly disables all patches.
func (*Lifecycle) WithSpecPatch ¶
WithSpecPatch enables spec patching when spec changes are detected.
func (*Lifecycle) WithSpread ¶
func (l *Lifecycle) WithSpread(sm SpreadManager) *Lifecycle
WithSpread enables reconciliation spreading. Panics if the object produced by newObj does not implement spread.SpreadReconcileStatus.
func (*Lifecycle) WithTerminator ¶
WithTerminator enables terminator support. When the given name is present in status.terminators (set by kcp), subroutines implementing Terminator will run Terminate instead of Finalize during deletion. The marker is removed from status once all subroutines complete successfully.
type SpreadManager ¶
type SpreadManager interface {
ReconcileRequired(obj client.Object) bool
RequeueDelay(obj client.Object) time.Duration
SetNextReconcileTime(obj client.Object)
UpdateObservedGeneration(obj client.Object)
RemoveRefreshLabel(obj client.Object) bool
}
SpreadManager manages reconciliation spreading.