Skip to content

Add EventRecorder to MCPOIDCConfig, MCPExternalAuthConfig, and MCPAuthzConfig controllers #5496

Closed

Description

@ChrisJBurns

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:

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.go
  • cmd/thv-operator/controllers/mcpexternalauthconfig_controller.go
  • cmd/thv-operator/controllers/mcpauthzconfig_controller.go

For each:

  1. Add Recorder record.EventRecorder (or events.EventRecorder) to the reconciler struct.
  2. Wire it in SetupWithManager via mgr.GetEventRecorderFor("<resource>-controller").
  3. Emit Warning events on ConfigInvalid and DeletionBlocked transitions.
  4. Emit a Normal event on recovery (validation passes after a prior failure).
  5. 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 a ConfigInvalid event when the spec is rejected by validation.
  • kubectl describe mcpauthzconfig <name> shows a DeletionBlocked event when deletion is gated by a referencing workload.
  • Same applies to mcpoidcconfig and mcpexternalauthconfig for 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

  1. added
    enhancement
    on Jun 11, 2026
  2. added
    needs-triage
    on Jun 11, 2026
  3. self-assigned this
    on Jun 11, 2026
  4. added
    kubernetes
    on Jun 11, 2026
  5. added a commit that references this issue on Jun 16, 2026
    141f9a4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementkubernetesneeds-triageoperator

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions