Use events.k8s.io in registry-api Role#5340
Merged
Merged
Conversation
After #5243, the operator's ClusterRole grants events only in the `events.k8s.io` API group, but the per-MCPRegistry Role builder still requested core `""/events`. Kubernetes RBAC escalation prevention forbids the operator from granting a permission it does not itself hold, so every MCPRegistry got stuck in phase `Failed`. Switch the registry-api Role rule to `events.k8s.io/events` to match the operator's own grant and the controller-runtime events API. Fixes #5339 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5340 +/- ##
==========================================
- Coverage 68.42% 68.36% -0.06%
==========================================
Files 620 620
Lines 63274 63274
==========================================
- Hits 43294 43257 -37
- Misses 16753 16790 +37
Partials 3227 3227 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jhrozek
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
events.k8s.io/events, but the per-MCPRegistryRole builder still asked for core""/events. RBAC escalation prevention then blocked the operator from creating that Role, leaving everyMCPRegistrystuck inphase: Failedwithreason: RBACFailed.events.k8s.io/eventsso it matches the operator's own grant.Fixes #5339
Test plan
go test ./cmd/thv-operator/pkg/registryapi/...)origin/mainreproduces the exactRBACFailederror from the issue; in-placehelm upgradeto the patched image reconciles cleanly (Role's events rule becomesapiGroups: ["events.k8s.io"],MCPRegistryadvances past RBAC).🤖 Generated with Claude Code