OLS-3973 - Fix ClusterRole RBAC breaking operator informers - #1976
OLS-3973 - Fix ClusterRole RBAC breaking operator informers#1976JoaoFula wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change updates controller RBAC markers and the ClusterServiceVersion manifest. List and watch permissions are now unscoped for cluster-wide informers. Resource-specific cluster role and binding permissions retain only get, update, and delete. ChangesCluster RBAC permission alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change restores operator informer access while keeping mutating permissions limited to managed resources; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@JoaoFula: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
PR #1954 (
OLS-3886 Tighten ClusterRole RBAC) scopedlistandwatchonclusterrolebindingsandclusterrolesto specificresourceNames. The security intent was correct, but it broke the operator:olsconfig_controller.gousesOwns(&rbacv1.ClusterRole{})andOwns(&rbacv1.ClusterRoleBinding{}), which sets up cluster-wide informers via controller-runtime.list+watch(no resource-name selector exists at the API level).listbecause the permission was scoped toresourceNames.lightspeed-app-serverdeployment never created.Evidence: periodic e2e failure — controller-manager logs show
clusterrolebindings.rbac.authorization.k8s.io is forbiddenfollowed by cache sync timeout and manager shutdown.Fix
Split read-only verbs (unscoped, required by informers) from mutating verbs (scoped to
resourceNames, prevents privilege escalation):list+watch→ unscoped (read-only, not a privilege escalation vector)get+update+delete→ scoped toresourceNames(unchanged, still pinned)Security posture preserved
createwithoutresourceNames— unchanged (Kubernetes ignoresresourceNamesoncreate).list+watchunscoped — read-only, the operator could already read these via its informer before OLS-3886 Tighten ClusterRole RBAC to prevent privilege escalation #1954.update+delete+getscoped to named resources — unchanged, still pinned to operator-managed resources only.internal/rbac/role_yaml_test.go— all pass (they checkupdate/delete/patchare pinned toresourceNames).Type of change
Related Tickets & Documents
Checklist before requesting a review
Testing
make testpasses — all unit tests including RBAC validation tests.make manifestsregeneratesconfig/rbac/role.yamlcorrectly from updated kubebuilder markers.ClusterRoleBindinginformer list call requires unscopedlist+watch.Summary by CodeRabbit