Repository navigation
Description
Summary
The three "config" controllers — MCPOIDCConfigReconciler, MCPExternalAuthConfigReconciler, and MCPAuthzConfigReconciler — currently log validation failures and deletion-blocked transitions but do not emit Kubernetes Event objects. For policy-shaped resources this is a meaningful gap: an operator running kubectl describe mcpauthzconfig <name> (or the siblings) won't see why a config is invalid or which workloads are blocking deletion.
This was flagged in the multi-agent review of #4777 as F15. The fix wasn't bundled into that PR because the operator rules (.claude/rules/operator.md §"Status Condition Parity") call for parity across sibling CRDs that share a feature set — adding EventRecorder to MCPAuthzConfig alone would create asymmetry with the two siblings that don't have one either.
Refs:
- Review comment: Add MCPAuthzConfig CRD for backend-agnostic authorization #4777 (comment)
- Review thread (PR Add MCPAuthzConfig CRD for backend-agnostic authorization #4777): Add MCPAuthzConfig CRD for backend-agnostic authorization #4777 (review)
Scope
Add an EventRecorder to all three reconcilers in a single PR so the parity is established as one logical change:
cmd/thv-operator/controllers/mcpoidcconfig_controller.gocmd/thv-operator/controllers/mcpexternalauthconfig_controller.gocmd/thv-operator/controllers/mcpauthzconfig_controller.go
For each:
- Add
Recorder record.EventRecorder(orevents.EventRecorder) to the reconciler struct. - Wire it in
SetupWithManagerviamgr.GetEventRecorderFor("<resource>-controller"). - Emit
Warningevents onConfigInvalidandDeletionBlockedtransitions. - Emit a
Normalevent on recovery (validation passes after a prior failure). - Do not include raw policy contents, bearer tokens, or PDP URLs in event messages — those are topology-/credential-sensitive.
Reference pattern: MCPServerReconciler in cmd/thv-operator/controllers/mcpserver_controller.go (struct field + nil-check guard around recorder calls).
Acceptance criteria
- All three controllers carry an
EventRecorder. -
kubectl describe mcpauthzconfig <name>shows aConfigInvalidevent when the spec is rejected by validation. -
kubectl describe mcpauthzconfig <name>shows aDeletionBlockedevent when deletion is gated by a referencing workload. - Same applies to
mcpoidcconfigandmcpexternalauthconfigfor their analogous failure/block events. - Test coverage uses
record.NewFakeRecorder(N)to assert events are emitted (or not) on each path. - No event message contains a raw policy, secret, bearer token, or fully-qualified internal URL.
Activity
Emit Events from the three config controllers (#5514)