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.