Skip to content

Commit 9435377

Browse files
Copilotphrocker
andauthored
Add cross-namespace RBAC for integration-proxy to access tenant-agents pods (#103)
* Initial plan * Add RBAC permissions for integration-proxy to access tenant-agents namespace Co-authored-by: phrocker <[email protected]> * Add documentation comments explaining cross-namespace RBAC setup Co-authored-by: phrocker <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: phrocker <[email protected]>
1 parent 6f7bdb8 commit 9435377

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- /*
2+
This Role grants the integration-proxy service account permissions to access pods and services
3+
in the ${TENANT}-agents namespace. This is required because the integration-proxy service
4+
(running in the ${TENANT} namespace) needs to list and monitor pods in both namespaces.
5+
6+
The corresponding RoleBinding (integrationproxy-agents-rolebinding.yaml) binds the
7+
service account from ${TENANT} namespace to this Role in ${TENANT}-agents namespace,
8+
enabling cross-namespace access.
9+
*/ -}}
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: Role
12+
metadata:
13+
name: {{ .Release.Name }}-integrationproxy-agents-role
14+
namespace: {{ .Values.tenant }}-agents
15+
rules:
16+
- apiGroups: [""]
17+
resources: ["pods", "services"]
18+
verbs: ["get", "list", "watch"]
19+
- apiGroups: [""]
20+
resources: ["pods/log"]
21+
verbs: ["get"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- /*
2+
This RoleBinding grants the integration-proxy service account (from ${TENANT} namespace)
3+
access to the Role in the ${TENANT}-agents namespace. This enables cross-namespace access
4+
so the integration-proxy can list pods and services in both the main tenant namespace and
5+
the agents namespace.
6+
7+
Note: The subjects.namespace field is required for cross-namespace RoleBindings to
8+
explicitly specify which namespace contains the ServiceAccount being granted permissions.
9+
*/ -}}
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: RoleBinding
12+
metadata:
13+
name: {{ .Release.Name }}-integrationproxy-agents-binding
14+
namespace: {{ .Values.tenant }}-agents
15+
subjects:
16+
- kind: ServiceAccount
17+
name: {{ .Release.Name }}-integrationproxy
18+
namespace: {{ .Values.tenant }}
19+
roleRef:
20+
kind: Role
21+
name: {{ .Release.Name }}-integrationproxy-agents-role
22+
apiGroup: rbac.authorization.k8s.io

0 commit comments

Comments
 (0)