From 9c9a877cb0133646a673898c110de986002a4899 Mon Sep 17 00:00:00 2001 From: Dmytro Rashko Date: Mon, 16 Nov 2026 04:02:45 +0100 Subject: [PATCH] feat(helm): grant read-only access to kagent v1alpha3 resources The read-only role now covers the api.kagent.dev resources served by kagent's latest API (v1alpha3): agents, agenttemplates, egresspolicies, harnesses, modelconfigs, modelproviderconfigs, remotemcpservers and sandboxtemplates. Full-access mode already covers them. Signed-off-by: Dmytro Rashko --- helm/kagent-tools/templates/clusterrole.yaml | 13 +++++++++++++ helm/kagent-tools/tests/rbac_test.yaml | 20 ++++++++++++++++++++ helm/kagent-tools/values.yaml | 1 + 3 files changed, 34 insertions(+) diff --git a/helm/kagent-tools/templates/clusterrole.yaml b/helm/kagent-tools/templates/clusterrole.yaml index 4fc0909..373ec2a 100644 --- a/helm/kagent-tools/templates/clusterrole.yaml +++ b/helm/kagent-tools/templates/clusterrole.yaml @@ -58,6 +58,19 @@ - horizontalpodautoscalers verbs: ["get", "list", "watch"] +# kagent resources (api.kagent.dev/v1alpha3) +- apiGroups: ["api.kagent.dev"] + resources: + - agents + - agenttemplates + - egresspolicies + - harnesses + - modelconfigs + - modelproviderconfigs + - remotemcpservers + - sandboxtemplates + verbs: ["get", "list", "watch"] + {{- if .Values.rbac.allowSecrets }} # Secrets (opt-in) - apiGroups: [""] diff --git a/helm/kagent-tools/tests/rbac_test.yaml b/helm/kagent-tools/tests/rbac_test.yaml index 980f5ef..412c3bb 100644 --- a/helm/kagent-tools/tests/rbac_test.yaml +++ b/helm/kagent-tools/tests/rbac_test.yaml @@ -12,6 +12,26 @@ tests: of: ClusterRoleBinding template: clusterrolebinding.yaml + - it: should grant read-only access to kagent v1alpha3 resources + set: + rbac.readOnly: true + template: clusterrole.yaml + asserts: + - contains: + path: rules + content: + apiGroups: ["api.kagent.dev"] + resources: + - agents + - agenttemplates + - egresspolicies + - harnesses + - modelconfigs + - modelproviderconfigs + - remotemcpservers + - sandboxtemplates + verbs: ["get", "list", "watch"] + - it: should render Roles when rbac.namespaces is set set: rbac.namespaces: diff --git a/helm/kagent-tools/values.yaml b/helm/kagent-tools/values.yaml index 45755f3..662df60 100644 --- a/helm/kagent-tools/values.yaml +++ b/helm/kagent-tools/values.yaml @@ -126,6 +126,7 @@ rbac: # and the global.watchNamespaces fallback would be unreachable. # namespaces: [] # When true, deploys a read-only ClusterRole (get, list, watch) instead of cluster-admin. + # The read-only role covers core workloads and kagent resources (api.kagent.dev). # Pairs well with the --read-only CLI flag which disables write operations at the application layer. # Only applies when rbac.create is true. # Defaults to False as to not introduce breaking changes. Worth revisiting later on.