Documentation
¶
Overview ¶
Package subroutines provides a lifecycle engine for Kubernetes controllers built on multicluster-runtime. It offers explicit Result-based flow control, opt-in condition/status/finalizer management, and built-in observability.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientFromContext ¶
ClientFromContext retrieves the client.Client from the context.
func MustClientFromContext ¶
MustClientFromContext retrieves the client.Client from the context. It panics if no client is stored in the context.
Types ¶
type Finalizer ¶
type Finalizer interface {
Subroutine
Finalize(ctx context.Context, obj client.Object) (Result, error)
Finalizers(obj client.Object) []string
}
Finalizer handles cleanup when an object is being deleted.
type Initializer ¶
type Initializer interface {
Subroutine
Initialize(ctx context.Context, obj client.Object) (Result, error)
}
Initializer handles one-time initialization when an initializer marker is present in status.
type Processor ¶
type Processor interface {
Subroutine
Process(ctx context.Context, obj client.Object) (Result, error)
}
Processor handles the main reconciliation logic for a subroutine.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result encodes the outcome of a subroutine invocation. The zero value represents a successful continue with no requeue.
func OKWithRequeue ¶
OKWithRequeue returns a Result that continues the chain and requeues after d.
func Pending ¶
Pending returns a Result that continues the chain, sets the condition to Unknown, and requeues after d. Use Pending when a subroutine is waiting on an external condition. Note: the lifecycle engine picks the shortest requeue across all subroutines, so a later subroutine returning OKWithRequeue with a shorter duration will take precedence. Panics if d <= 0.
func SkipAll ¶
SkipAll halts the subroutine chain and marks remaining subroutines as Skipped. The ready flag controls the aggregate Ready condition: true sets it to True, false sets it to False.
func StopWithRequeue ¶
StopWithRequeue returns a Result that stops the chain and requeues after d.
func (Result) IsContinue ¶
IsContinue returns true if the result is OK or OKWithRequeue. Note: Pending also continues the chain but returns false here — use IsPending to check for that case separately.
func (Result) IsSkipAll ¶
IsSkipAll returns true if the result halts the chain and marks remaining subroutines as Skipped.
func (Result) IsStopWithRequeue ¶
IsStopWithRequeue returns true if the result stops the chain with a requeue.
type Subroutine ¶
type Subroutine interface {
GetName() string
}
Subroutine is the base interface that all subroutines must implement.
type Terminator ¶
type Terminator interface {
Subroutine
Terminate(ctx context.Context, obj client.Object) (Result, error)
}
Terminator handles ordered teardown when a terminator marker is present in status.
