Documentation
¶
Overview ¶
Package reconciler implements the Reconciler component that debounces resource changes and triggers reconciliation events.
The Reconciler is a key component in Stage 5 of the controller startup sequence. It subscribes to resource change events, applies debouncing to batch rapid changes, and publishes reconciliation trigger events when the system reaches a quiet state.
Index ¶
Constants ¶
const ( // DefaultDebounceInterval is the default time to wait after the last resource // change before triggering reconciliation. DefaultDebounceInterval = 500 * time.Millisecond // EventBufferSize is the size of the event subscription buffer. // Size 100: Medium-volume component that receives resource change events from // multiple watchers (Ingress, HTTPRoute, Service, Endpoints, Secrets, ConfigMaps). // Higher than deployer to handle bursts when many resources change simultaneously. EventBufferSize = 100 )
const ComponentName = "reconciler"
ComponentName is the unique identifier for this component.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DebounceInterval is the time to wait after the last resource change
// before triggering reconciliation. If not set, DefaultDebounceInterval is used.
DebounceInterval time.Duration
}
Config configures the Reconciler component.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler implements the reconciliation debouncer component.
It subscribes to resource change events and index synchronization events, applies debouncing logic to prevent excessive reconciliations, and triggers reconciliation when appropriate.
Debouncing behavior:
- Resource changes: Wait for quiet period (debounce interval) before triggering
- Index synchronized: Trigger immediately (initial reconciliation after all resources synced)
The component publishes ReconciliationTriggeredEvent to signal the Executor to begin a reconciliation cycle.
func New ¶
New creates a new Reconciler component.
Parameters:
- eventBus: The EventBus for subscribing to events and publishing triggers
- logger: Structured logger for component logging
- config: Optional configuration (nil for defaults)
Returns:
- A new Reconciler instance ready to be started
func (*Reconciler) Name ¶
func (r *Reconciler) Name() string
Name returns the unique identifier for this component. Implements the lifecycle.Component interface.
func (*Reconciler) Start ¶
func (r *Reconciler) Start(ctx context.Context) error
Start begins the reconciler's event loop.
This method blocks until the context is cancelled or an error occurs. The component is already subscribed to the EventBus (subscription happens in New()), so this method only processes events:
- ResourceIndexUpdatedEvent: Starts/resets debounce timer
- IndexSynchronizedEvent: Triggers initial reconciliation when all resources synced
- Debounce timer expiration: Publishes ReconciliationTriggeredEvent
The component runs until the context is cancelled, at which point it performs cleanup and returns.
Parameters:
- ctx: Context for cancellation and lifecycle management
Returns:
- nil when context is cancelled (graceful shutdown)
- Error only in exceptional circumstances