Skip to content

Commit bcd47de

Browse files
feat(helm): support namespaced RBAC in charts (#1549)
Close #1546 - Adds a helm value to configure whether to use cluster scoped or namespaced RBAC for getter and writer roles - Render controller roles to `Role/RoleBinding` or `ClusterRole/ClusterRoleBinding` conditionally - Updated helm unit tests, tested manually by impersonating the service accounts - Limitation: When controller is not using cluster scoped role, either manually set `controller.watchNamespaces` or it is defaulted to the namespace accessible by the role. --------- Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
1 parent 9dcee3a commit bcd47de

File tree

14 files changed

+318
-602
lines changed

14 files changed

+318
-602
lines changed

.github/workflows/ci.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,29 @@ jobs:
102102
# no need to run e2e tests with race, as this will just apply to the test code.
103103
# all objects created in e2e tests have a generated name, so they can run in parallel safely.
104104
go test -v github.com/kagent-dev/kagent/go/core/test/e2e -failfast -shuffle=on
105+
106+
- name: Run namespace-scoped e2e tests
107+
if: success()
108+
env:
109+
OPENAI_API_KEY: fake
110+
KAGENT_HELM_EXTRA_ARGS: >-
111+
--set rbac.clusterScoped=false
112+
--set 'rbac.namespaces={kagent}'
113+
run: |
114+
# Upgrade helm to use namespace-scoped RBAC
115+
make helm-install-provider
116+
117+
# Wait for controller to be ready after upgrade
118+
kubectl rollout status deployment/kagent-controller -n kagent --timeout=90s
119+
120+
# Setup environment variables (reusing logic from previous step)
121+
HOST_IP=$(docker network inspect kind -f '{{range .IPAM.Config}}{{if .Gateway}}{{.Gateway}}{{"\n"}}{{end}}{{end}}' | grep -E '^[0-9]+\.' | head -1)
122+
export KAGENT_LOCAL_HOST=$HOST_IP
123+
export KAGENT_URL="http://$(kubectl get svc -n kagent kagent-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):8083"
124+
125+
# Run critical tests with namespace-scoped RBAC to verify the controller didn't lose needed permissions
126+
cd go
127+
go test -v github.com/kagent-dev/kagent/go/core/test/e2e -run '^TestE2EInvokeInlineAgent$|^TestE2EInvokeDeclarativeAgentWithMcpServerTool$' -failfast
105128
- name: fail print info
106129
if: failure()
107130
run: |

helm/agents/argo-rollouts/templates/rbac.yaml

Lines changed: 0 additions & 126 deletions
This file was deleted.

helm/agents/cilium-debug/templates/rbac.yaml

Lines changed: 0 additions & 68 deletions
This file was deleted.

helm/agents/cilium-manager/templates/rbac.yaml

Lines changed: 0 additions & 87 deletions
This file was deleted.

helm/agents/cilium-policy/templates/rbac.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)