OLS-3240: Add missing RBAC markers for core API resources#81
Conversation
The generated ClusterRole was missing permissions for core Kubernetes resources (ServiceAccounts, ConfigMaps, Services, Deployments) and OpenShift resources (ConsolePlugins, Consoles) that the operator creates at runtime. This was masked by cluster-admin in all current deployments. Add +kubebuilder:rbac markers to controller/sandbox/bootstrap.go and controller/console/reconciler.go. Widen make manifests path from controller/proposal/... to controller/... so controller-gen picks up markers from all controller packages. Verified on live cluster: operator now starts successfully under least-privilege RBAC with only the generated role.yaml (no cluster-admin). Co-authored-by: Cursor <cursoragent@cursor.com>
|
@onmete: This pull request references OLS-3240 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR expands CRD and RBAC manifest generation to include all controller packages. The Makefile ChangesRBAC and CRD Generation Expansion
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
|
[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 |
|
@onmete: all tests passed! 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. |
Summary
+kubebuilder:rbacmarkers for core Kubernetes resources (ServiceAccounts,ConfigMaps,Services,Deployments) and OpenShift resources (ConsolePlugins,Consoles) tocontroller/sandbox/bootstrap.goandcontroller/console/reconciler.gomake manifestscontroller-gen path fromcontroller/proposal/...tocontroller/...so all controller packages are scannedconfig/rbac/role.yamlwith the complete set of permissionsContext
The generated
ClusterRoleinconfig/rbac/role.yamlwas missing permissions for resources the operator creates at runtime (EnsureBaseSandboxTemplatecreates ServiceAccounts,EnsureAgenticConsolecreates Deployments/Services/ConfigMaps/ConsolePlugins). This was masked bycluster-admingranted viahack/agentic/deploy.sh, but would causeForbiddenerrors under least-privilege RBAC.Testing
make vet— passedmake api-lint— passedmake test— passedmake manifests— regenerated role.yaml verifiedserviceaccounts is forbidden→ operator crashesServiceAccount ready/SandboxTemplate ready/Base SandboxTemplate bootstrap complete→ operator 1/1 Runningmake test-e2e— pre-existing failures (spec.tools.skills[0].paths: Required value), unrelated to this changeFixes: https://issues.redhat.com/browse/OLS-3240
Made with Cursor