fix(manifests): add roles permission to control-plane ClusterRole#1449
fix(manifests): add roles permission to control-plane ClusterRole#1449mergify[bot] merged 2 commits intomainfrom
Conversation
The control-plane's ensureControlPlaneRBAC creates a Role named ambient-control-plane-project-manager in each project namespace, but the ClusterRole only granted access to rolebindings, not roles. This caused "forbidden: cannot get resource roles" errors on project reconciliation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
📝 WalkthroughWalkthroughExtended the control-plane ClusterRole to include permissions for both Changes
🚥 Pre-merge checks | ✅ 7 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/manifests/base/rbac/control-plane-clusterrole.yaml`:
- Around line 18-20: The current RBAC rule groups resources "roles" and
"rolebindings" under apiGroups: ["rbac.authorization.k8s.io"] and grants the
full verb set; split this into two rules: one rule for "roles" that only
includes the minimal verbs the reconciler requires (e.g., "get" and "create")
and a separate rule for "rolebindings" that retains the broader verbs
("list","watch","update","patch","delete" as needed). Update the resources/verbs
entries so "roles" no longer inherits the full rolebindings verb set while
keeping rolebindings' permissions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 91ad1c42-40d0-4c82-a79e-155c546444c2
📒 Files selected for processing (1)
components/manifests/base/rbac/control-plane-clusterrole.yaml
| - apiGroups: ["rbac.authorization.k8s.io"] | ||
| resources: ["rolebindings"] | ||
| resources: ["roles", "rolebindings"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] |
There was a problem hiding this comment.
Narrow roles permissions instead of inheriting full rolebindings verbs.
Line 19 fixes the missing roles access, but Line 20 now gives roles the full rolebindings verb set (list/watch/update/patch/delete) even though the provided reconcile path shows get + create for roles. Split this rule so roles has only required verbs, and keep broader verbs on rolebindings.
Suggested RBAC tightening
- apiGroups: ["rbac.authorization.k8s.io"]
- resources: ["roles", "rolebindings"]
- verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
+ resources: ["roles"]
+ verbs: ["get", "create", "delete"]
+- apiGroups: ["rbac.authorization.k8s.io"]
+ resources: ["rolebindings"]
+ verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]As per coding guidelines, components/manifests/**/*.yaml: - RBAC must follow least-privilege.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - apiGroups: ["rbac.authorization.k8s.io"] | |
| resources: ["rolebindings"] | |
| resources: ["roles", "rolebindings"] | |
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | |
| - apiGroups: ["rbac.authorization.k8s.io"] | |
| resources: ["roles"] | |
| verbs: ["get", "create", "delete"] | |
| - apiGroups: ["rbac.authorization.k8s.io"] | |
| resources: ["rolebindings"] | |
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@components/manifests/base/rbac/control-plane-clusterrole.yaml` around lines
18 - 20, The current RBAC rule groups resources "roles" and "rolebindings" under
apiGroups: ["rbac.authorization.k8s.io"] and grants the full verb set; split
this into two rules: one rule for "roles" that only includes the minimal verbs
the reconciler requires (e.g., "get" and "create") and a separate rule for
"rolebindings" that retains the broader verbs
("list","watch","update","patch","delete" as needed). Update the resources/verbs
entries so "roles" no longer inherits the full rolebindings verb set while
keeping rolebindings' permissions unchanged.
Merge Queue Status
This pull request spent 9 seconds in the queue, including 1 second running CI. Required conditions to merge |
Summary
rolesto the control-plane ClusterRole alongsiderolebindingsin therbac.authorization.k8s.ioAPI groupensureControlPlaneRBAC(project_reconciler.go:194) creates a Roleambient-control-plane-project-managerin each project namespace, but the ClusterRole only granted access torolebindings— causingforbidden: cannot get resource "roles"errorsTest plan
["roles", "rolebindings"]🤖 Generated with Claude Code
Summary by CodeRabbit