Documentation
¶
Overview ¶
Package reconcile contains high-level release reconciliation orchestration.
Index ¶
- Constants
- func ComputeBackoff(failureCount int64) time.Duration
- func ReconcileModuleRelease(ctx context.Context, params *ModuleReleaseParams, req ctrl.Request) (ctrl.Result, error)
- func ReconcileRelease(ctx context.Context, params *ReleaseParams, req ctrl.Request) (ctrl.Result, error)
- type BundleRelease
- type ModuleReleaseParams
- type Outcome
- type ReleaseParams
Constants ¶
const ( // BackoffBaseDelay is the initial retry delay after the first transient failure. BackoffBaseDelay = 5 * time.Second // BackoffMaxDelay is the maximum retry delay (cap for exponential growth). BackoffMaxDelay = 5 * time.Minute // StalledRecheckInterval is the periodic safety recheck for stalled failures, // guarding against misclassification. StalledRecheckInterval = 30 * time.Minute )
const DefaultReleaseInterval = 5 * time.Minute
DefaultReleaseInterval is the fallback requeue interval when spec.interval is not set.
const ( // FinalizerName is the finalizer registered on ModuleRelease resources // to ensure owned resources are cleaned up before deletion completes. FinalizerName = "releases.opmodel.dev/cleanup" )
Variables ¶
This section is empty.
Functions ¶
func ComputeBackoff ¶
ComputeBackoff returns the exponential backoff delay for a given failure count. Formula: min(baseDelay * 2^(failures-1), maxDelay). Returns baseDelay when failureCount is 0 or 1.
func ReconcileModuleRelease ¶
func ReconcileModuleRelease( ctx context.Context, params *ModuleReleaseParams, req ctrl.Request, ) (ctrl.Result, error)
ReconcileModuleRelease orchestrates all phases of the reconcile loop. Phases run sequentially; errors halt progression. Status is always patched at the end via deferred function.
func ReconcileRelease ¶
func ReconcileRelease( ctx context.Context, params *ReleaseParams, req ctrl.Request, ) (ctrl.Result, error)
ReconcileRelease runs the full Release reconcile loop: source resolution, artifact fetch, path navigation, CUE load, kind detection, render, apply, prune, and status commit. Mirrors the ModuleRelease loop but sources the CUE package from a Flux artifact instead of synthesizing it.
Types ¶
type BundleRelease ¶
type BundleRelease struct{}
BundleRelease is implemented during bundle reconcile work.
type ModuleReleaseParams ¶
type ModuleReleaseParams struct {
Client client.Client
// APIReader is an uncached reader used for one-off reads (e.g. ServiceAccount
// existence checks for impersonation) that should not provision a cache informer.
APIReader client.Reader
RestConfig *rest.Config
Provider *provider.Provider
ResourceManager *fluxssa.ResourceManager
EventRecorder events.EventRecorder
// Renderer produces the render result for a ModuleRelease. Must be non-nil;
// production wires render.RegistryRenderer, tests wire a stub.
Renderer render.ModuleRenderer
}
ModuleReleaseParams holds the dependencies injected into the reconcile loop.
type Outcome ¶
type Outcome int
Outcome classifies the result of a reconcile attempt. Drives requeue behavior and condition setting.
const ( // NoOp — all four digests match last applied. Ready=True, Reconciling=False. // Requeue: none (watch-driven only). NoOp Outcome = iota // Applied — resources applied successfully (no prune needed or prune disabled). // Ready=True, Reconciling=False. Requeue: none. Applied // AppliedAndPruned — resources applied and stale resources pruned. // Ready=True, Reconciling=False. Requeue: none. AppliedAndPruned // FailedTransient — temporary failure (network, API server). // Ready=False, Reconciling=True. Requeue: exponential backoff. FailedTransient // FailedStalled — permanent failure (invalid config, invalid module). // Ready=False, Stalled=True. Requeue: none (wait for spec change). FailedStalled )
func (Outcome) MetricLabel ¶
MetricLabel returns the snake_case label value for Prometheus metrics.
type ReleaseParams ¶
type ReleaseParams struct {
Client client.Client
// APIReader is an uncached reader used for one-off reads (e.g. ServiceAccount
// existence checks for impersonation) that should not provision a cache informer.
APIReader client.Reader
RestConfig *rest.Config
Provider *provider.Provider
ResourceManager *fluxssa.ResourceManager
EventRecorder events.EventRecorder
// Fetcher downloads Flux source artifacts. Typically
// &opmsource.ArtifactFetcher{} in production; tests inject a stub.
Fetcher opmsource.Fetcher
// Renderer loads and renders a CUE release package from a local directory.
// Production wires render.PackageReleaseRenderer; tests inject a stub.
Renderer render.ReleaseRenderer
}
ReleaseParams holds the dependencies for the Release reconcile loop.