Summary
The AgentReconciler currently does not emit Kubernetes events when reconciling Agent resources. Adding event recording would improve observability by surfacing reconciliation activity (e.g. agent updated, deployment created, reconcile failed) via kubectl describe agent <name> and kubectl get events.
Current State
- RBAC markers for
events and events.k8s.io are already in place (agent_reconciler.go lines 68-69)
- The webhook layer already uses
EventRecorder for recording events
- The
AgentReconciler struct has no Recorder field
Proposed Changes
- Add
record.EventRecorder to AgentReconciler struct (internal/controller/agent_reconciler.go)
- Wire the recorder in
cmd/main.go via mgr.GetEventRecorderFor("agent-controller")
- Emit events in the reconcile loop for key state transitions:
Normal / Updated — Agent spec reconciled successfully
Normal / Created — Deployment or Service created
Warning / ReconcileFailed — Reconciliation error
- Update tests to supply a fake recorder in
BeforeEach blocks
Acceptance Criteria