feat(helm): support namespaced RBAC in charts#1549
Merged
EItanya merged 6 commits intokagent-dev:mainfrom Mar 26, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in Helm configuration to render RBAC as either cluster-scoped (ClusterRole/ClusterRoleBinding) or namespaced (Role/RoleBinding), intended to support restricted environments while keeping current behavior as the default.
Changes:
- Introduces
rbac.create,rbac.clusterScoped, andrbac.namespacesHelm values for RBAC scoping control. - Splits controller RBAC into dedicated getter/writer Role(+Binding) templates with conditional cluster vs namespace scope.
- Updates several agent subchart RBAC templates to conditionally render Role/RoleBinding vs ClusterRole/ClusterRoleBinding and expands Helm unit tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| helm/kagent/values.yaml | Adds RBAC configuration values to control scoping and optional namespaces. |
| helm/kagent/tests/rbac_test.yaml | Updates/extends Helm unit tests for the new RBAC templates and scoping modes. |
| helm/kagent/templates/rbac/getter-role.yaml | Refactors getter rules into a named template and conditionally renders ClusterRole vs Role. |
| helm/kagent/templates/rbac/getter-rolebinding.yaml | Conditionally renders ClusterRoleBinding vs RoleBinding (including multi-namespace support). |
| helm/kagent/templates/rbac/writer-role.yaml | New writer RBAC template with conditional ClusterRole vs Role rendering. |
| helm/kagent/templates/rbac/writer-rolebinding.yaml | New writer binding template with conditional ClusterRoleBinding vs RoleBinding rendering. |
| helm/agents/istio/templates/rbac.yaml | Adds conditional cluster-scoped vs namespaced RBAC (including multi-namespace support). |
| helm/agents/cilium-policy/templates/rbac.yaml | Adds conditional cluster-scoped vs namespaced RBAC (including multi-namespace support). |
| helm/agents/cilium-manager/templates/rbac.yaml | Adds conditional cluster-scoped vs namespaced RBAC (including multi-namespace support). |
| helm/agents/cilium-debug/templates/rbac.yaml | Adds conditional cluster-scoped vs namespaced RBAC (including multi-namespace support). |
| helm/agents/argo-rollouts/templates/rbac.yaml | Adds conditional cluster-scoped vs namespaced RBAC (including multi-namespace support). |
Comments suppressed due to low confidence (3)
helm/kagent/templates/rbac/getter-role.yaml:102
- The included
kagent.getter.rulestemplate containsapiGroups: ["gateway.networking.k8s.io/v1"]. RBACapiGroupsmust not include a version (and/is invalid), so the rendered (Cluster)Role will be rejected by the API server. Change it togateway.networking.k8s.io(and keepv1only in resource manifests).
helm/kagent/templates/rbac/getter-rolebinding.yaml:18 - The controller ServiceAccount is created in
{{ include "kagent.namespace" . }}(supportsnamespaceOverride), but this binding hard-codes the subject namespace to.Release.Namespace. WhennamespaceOverrideis set, the RoleBinding/ClusterRoleBinding will point at a ServiceAccount in the wrong namespace and RBAC won’t work. Useinclude "kagent.namespace"for the subject namespace (and default the$namespaceslist to that same namespace whenrbac.namespacesis empty).
helm/kagent/tests/rbac_test.yaml:123 - The
namespaceOverridebehavior is tested for ServiceAccounts, but there’s no assertion that the RBAC bindings’subjects[0].namespacetracks the same overridden namespace. Since the RBAC templates currently reference.Release.Namespace, adding a unit test that setsnamespaceOverrideand asserts the rolebinding/clusterrolebinding subject namespace would prevent regressions here.
- it: should use custom namespace when overridden
set:
namespaceOverride: "custom-namespace"
templates:
- controller-serviceaccount.yaml
- ui-serviceaccount.yaml
asserts:
- equal:
path: metadata.namespace
value: custom-namespace
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
f4ada08 to
5e2c8f3
Compare
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
EItanya
pushed a commit
to kagent-dev/kmcp
that referenced
this pull request
Mar 27, 2026
Sibling of kagent-dev/tools#53 and kagent-dev/kagent#1549 Fixes a CI issue. Also separates out the build step in CI before running E2E tests. --------- Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
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.
Close #1546
Role/RoleBindingorClusterRole/ClusterRoleBindingconditionallycontroller.watchNamespacesor it is defaulted to the namespace accessible by the role.