domain

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

domain/generic.go

domain/health.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyReconcileHooks

type AnyReconcileHooks interface {
	// contains filtered or unexported methods
}

AnyReconcileHooks is the type-erased form of ReconcileHooks[T]. GenericReconciler holds the concrete typed version internally. This exists only so the Katalog can store hooks without knowing T.

type Health

type Health interface {
	// SetReady marks the component as initialised and ready to process work.
	// Called once by the component after successful startup.
	// Implies the component is also healthy.
	SetReady()

	// Degraded marks the component as alive but not ready to process work.
	// Used when a recoverable error condition is detected — for example,
	// when a CRD's consecutive failure threshold is exceeded.
	// The component remains running but is removed from the ready pool.
	// Distinct from Unhealthy: the process does not need to be restarted.
	Degraded()

	// Unhealthy marks the component as neither healthy nor ready.
	// Called during shutdown or when an unrecoverable error is detected.
	// A Kubernetes liveness probe failing on this state will trigger a restart.
	Unhealthy()

	// Healthy returns true if the component is in a healthy state.
	// Maps to the Kubernetes liveness probe — false triggers a pod restart.
	Healthy() bool

	// Ready returns true if the component is initialised and ready to process work.
	// Maps to the Kubernetes readiness probe — false removes the pod from service endpoints.
	Ready() bool

	// Started returns true if the component has been started at least once.
	// Used by the manager to guard against double-start and to sequence
	// post-start hooks correctly.
	Started() bool
}

Health is the observability contract for any Orkestra Komponent that exposes liveness and readiness state.

Implementations are expected to be safe for concurrent use — all methods may be called from multiple goroutines simultaneously.

The distinction between healthy and ready follows the Kubernetes convention:

  • Healthy (liveness) — the component is alive and not in a broken state. An unhealthy component should be restarted.
  • Ready (readiness) — the component is initialised and able to serve traffic or process work. A non-ready component should not receive work yet but does not need to be restarted.

Typical lifecycle:

NewComponent()  → healthy: false, ready: false
Start()         → healthy: true,  ready: true   (via SetReady + Healthy)
Shutdown()      → healthy: false, ready: false   (via Unhealthy)
Error condition → healthy: false, ready: true    (via Degraded — still alive, not accepting work)

type Komponent

type Komponent interface {

	// Start() starts the komponents
	Start(context.Context) error

	// Shutdown() shuts down the komponent gracefully
	Shutdown(context.Context)

	// Name() returns the name of the komponent
	Name() string

	// Started() is set when manager starts a komponent
	Started() bool
}

type Object

type Object interface {
	metav1.Object
	runtime.Object
}

type ObjectList

type ObjectList interface {
	metav1.ListInterface
	runtime.Object
}

type ReconcileHooks

type ReconcileHooks[T Object] struct {
	// OnReconcile is called for every create/update event.
	// obj is already type-asserted and deep-copied.
	// Return an error to requeue with backoff.
	OnReconcile func(ctx context.Context, obj T) error

	// OnDelete is called when the object's DeletionTimestamp is set.
	// Use this to clean up external resources before the finalizer is removed.
	// If nil, deletion is a no-op (finalizer removed automatically).
	OnDelete func(ctx context.Context, obj T) error

	// OnNotFound is called when the object no longer exists in the store.
	// Use this for cleanup that depends on the key but not the object.
	// If nil, not-found is a no-op.
	OnNotFound func(ctx context.Context, key string) error
}

ReconcileHooks contains the user-provided business logic. Only implement the hooks you need — all are optional.

type Reconciler

type Reconciler interface {
	// Reconcile handles the actual business logic for a resource
	Reconcile(ctx context.Context, key string) error
}

Jump to

Keyboard shortcuts

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