Add disableWorkloadRBAC flag to skip per-workload RBAC creation#4030
Open
Add disableWorkloadRBAC flag to skip per-workload RBAC creation#4030
Conversation
3fe7ae2 to
57e9006
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4030 +/- ##
=======================================
Coverage 68.66% 68.67%
=======================================
Files 445 445
Lines 45343 45361 +18
=======================================
+ Hits 31136 31151 +15
- Misses 11802 11805 +3
Partials 2405 2405 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
57e9006 to
45382c3
Compare
Some K8s platform teams reject the operator because its ClusterRole includes roles/rolebindings permissions for dynamic RBAC creation. This adds an opt-in DISABLE_WORKLOAD_RBAC env var (exposed via operator.rbac.disableWorkloadRBAC Helm value) so the operator skips per-workload ServiceAccount, Role, and RoleBinding creation. When enabled: - All controller ensureRBACResources() methods return nil immediately - ClusterRole omits roles/rolebindings rules and SA write verbs - Registry API ClusterRole/ClusterRoleBinding are not rendered - Users must pre-create RBAC resources externally Default behavior (false) is unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The ClusterRole is generated by controller-gen and CI verifies it matches. Helm conditionals cannot be used in generated files. The operator code guards are the enforcement mechanism — the ClusterRole permissions are a ceiling, not a guarantee. The registry-api ClusterRole/ClusterRoleBinding (hand-managed) retain their conditionals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
65f0915 to
08bfe6d
Compare
yrobla
approved these changes
Mar 6, 2026
ChrisJBurns
reviewed
Mar 6, 2026
| featureVMCP = "ENABLE_VMCP" | ||
| // disableWorkloadRBAC disables per-workload RBAC management (ServiceAccount, Role, RoleBinding). | ||
| // When enabled, the operator will not create RBAC resources for workloads, | ||
| // allowing them to be managed externally (e.g., via per-workload Helm charts). |
Collaborator
There was a problem hiding this comment.
I'm not sure if we want to create Helm Charts for this - Seems a bit overkill? It will only be 3 resources?
| @@ -1,3 +1,4 @@ | |||
| {{- if not .Values.operator.rbac.disableWorkloadRBAC }} | |||
Collaborator
There was a problem hiding this comment.
I don't actually think this is used anyways. This was added previously by RedHat but I don't think it's used.
| @@ -1,3 +1,4 @@ | |||
| {{- if not .Values.operator.rbac.disableWorkloadRBAC }} | |||
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
DISABLE_WORKLOAD_RBACenv var andoperator.rbac.disableWorkloadRBACHelm value (default:false)roles/rolebindingspermissions and ServiceAccount write verbs from the operator's ClusterRoleMotivation
Some Kubernetes platform teams enforce strict policies on which cluster-scoped resources an operator's ClusterRole may reference. In environments managed by GitOps tools like ArgoCD, app-projects must whitelist every cluster-scoped resource the operator needs — including
rolesandrolebindingspermissions used for dynamic RBAC creation at runtime. This creates friction for adoption in security-conscious environments.By allowing the operator to opt out of per-workload RBAC management, platform teams can:
roles/rolebindingspermissions, eliminating the need to whitelist those resources in app-project definitionsget/list/watch) and loses all write permissions for RBAC resourcesThis is PR1 of a two-part effort. A follow-up PR will add per-workload Helm charts that bundle SA + Role + RoleBinding + CR for each workload type, providing a turnkey solution for externally-managed RBAC.
Changes
Go code:
DISABLE_WORKLOAD_RBACconstant and flag reading inmain.go, passed to all controller setup functionsDisableWorkloadRBAC boolfield added toMCPServerReconciler,MCPRemoteProxyReconciler, andVirtualMCPServerReconciler— each guardsensureRBACResources()with an early returnregistryapi.manageraccepts the flag and guards its ownensureRBACResources()NewMCPRegistryReconcilerforwards the flag to the registry API managerHelm charts:
operator.rbac.disableWorkloadRBACvalue invalues.yamlandvalues-openshift.yamlDISABLE_WORKLOAD_RBACenv var indeployment.yamlserviceaccountssplit into its own rule block with conditional write verbs;roles/rolebindingsblock wrapped in conditionalregistry-api-clusterrole.yamlandregistry-api-clusterrolebinding.yamlwrapped in conditionalTests:
ensureRBACResourcesreturns nil and creates no resources when disabledexternalRBAC-values.yaml) for Helm template lintingHow to use
When this flag is set, users must pre-create the following resources for each workload:
<name>-proxy-runnerServiceAccount/Role/RoleBinding +<name>-mcp-serverServiceAccount<name>-remote-proxy-runnerServiceAccount/Role/RoleBinding<name>-vmcpServiceAccount/Role/RoleBinding<name>-registry-apiServiceAccount/Role/RoleBindingDeployments will fail to schedule if the required ServiceAccounts are not present — this is a safe fail-closed behavior.
Test plan
task lint-fix— 0 issuestask test— all unit tests pass (exit 0)helm templatewithexternalRBAC-values.yaml— ClusterRole has no roles/rolebindings, SA is read-only, registry-api resources absenthelm templatewith defaults — output unchanged from maintask helm-docs— README regenerated🤖 Generated with Claude Code