Documentation
¶
Overview ¶
Package executor implements the Executor component that orchestrates reconciliation cycles by coordinating pure components.
The Executor is a key component in Stage 5 of the controller startup sequence. It subscribes to reconciliation trigger events, orchestrates pure components (Renderer, Validator, Deployer), and publishes events at each stage for observability and coordination.
Index ¶
Constants ¶
const ( // ComponentName is the unique identifier for this component. ComponentName = "executor" // EventBufferSize is the size of the event subscription buffer. EventBufferSize = 50 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor implements the reconciliation orchestrator component.
It subscribes to ReconciliationTriggeredEvent and orchestrates the reconciliation workflow:
- Render templates with current resource state
- Validate generated configuration
- Deploy validated configuration to HAProxy instances
The component publishes events at each stage for observability:
- ReconciliationStartedEvent: Reconciliation cycle begins
- TemplateRenderedEvent: Template rendering completes
- ValidationCompletedEvent: Validation succeeds
- DeploymentCompletedEvent: Deployment succeeds
- ReconciliationCompletedEvent: Full cycle completes
- ReconciliationFailedEvent: Any stage fails
func New ¶
New creates a new Executor component.
Parameters:
- eventBus: The EventBus for subscribing to events and publishing results
- logger: Structured logger for component logging
Returns:
- A new Executor instance ready to be started
func (*Executor) Name ¶
Name returns the unique identifier for this component. Implements the lifecycle.Component interface.
func (*Executor) Start ¶
Start begins the executor'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:
- ReconciliationTriggeredEvent: Starts orchestration of reconciliation cycle
- TemplateRenderedEvent: Handles successful template rendering
- TemplateRenderFailedEvent: Handles template rendering failures
- ValidationCompletedEvent: Handles successful validation
- ValidationFailedEvent: Handles validation failures
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