Skip to content

Commit c010e23

Browse files
obezpalkoclaude
andcommitted
refactor: per-namespace model — namespace-scoped RBAC, no GatewayClass
- ClusterRole/ClusterRoleBinding → Role/RoleBinding (all operator resources are namespace-scoped, no cluster-wide permissions needed) - Remove gatewayclass.yaml — Envoy Gateway installs the "eg" class automatically; chart now defaults to gateway.className=eg - Operator always scoped to release namespace (--watch-namespace and --gateway-namespace hardwired to .Release.Namespace) - gateway.allowedRouteNamespaces defaults to Same - Removed gateway.namespace, operator.gatewayNamespace, operator.watchNamespace values and unused _helpers.tpl entries - README: simplify to one helm install per namespace Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4f0f29c commit c010e23

8 files changed

Lines changed: 29 additions & 69 deletions

File tree

README.md

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ helm install eg oci://docker.io/envoyproxy/gateway-helm \
3030

3131
## Install
3232

33+
Run once per namespace. Each install is fully self-contained — operator + Gateway scoped to that namespace:
34+
3335
```bash
34-
# Install the operator + GatewayClass + Gateway from GHCR
3536
helm install envoy-router oci://ghcr.io/comet-ml/charts/envoy-router \
3637
--version 0.1.0 \
37-
--namespace envoy-router --create-namespace
38+
--namespace ns-1 --create-namespace
3839
```
3940

40-
This installs the operator, a `GatewayClass`, and a `Gateway` in the `envoy-router` namespace.
41+
The operator watches only its own namespace and attaches HTTPRoutes to the Gateway in the same namespace.
4142

4243
## Making a pod routable
4344

@@ -58,43 +59,28 @@ Key Helm values:
5859
| Value | Default | Description |
5960
|---|---|---|
6061
| `operator.podPort` | `8080` | Port the pods listen on |
61-
| `operator.watchNamespace` | `""` | Restrict to one namespace (empty = all) |
62-
| `gateway.allowedRouteNamespaces` | `All` | Namespaces that can attach HTTPRoutes |
63-
| `gateway.create` | `true` | Set `false` to bring your own Gateway |
62+
| `gateway.create` | `true` | Set `false` to skip Gateway creation |
63+
| `gateway.className` | `eg` | GatewayClass name (Envoy Gateway installs `eg` by default) |
64+
| `gateway.port` | `80` | Listener port on the Gateway |
6465

6566
## Multi-namespace setup
6667

67-
If you have multiple namespaces each with their own ALB, deploy one `Gateway` per namespace. A single Envoy Gateway controller and a single operator instance serve the whole cluster.
68-
69-
```
70-
ns-1: ALB-1 → Gateway (ns-1) → HTTPRoutes for pp-* in ns-1
71-
ns-2: ALB-2 → Gateway (ns-2) → HTTPRoutes for pp-* in ns-2
72-
```
73-
74-
**ALB configuration:** each ALB needs only one rule — forward `/*` to the Envoy Gateway service in that namespace. No per-pod rules.
75-
76-
**Install the operator once** (cluster-wide, no Gateway):
68+
Each namespace is fully independent — just repeat the install:
7769

7870
```bash
7971
helm install envoy-router oci://ghcr.io/comet-ml/charts/envoy-router \
80-
--version 0.1.0 \
81-
--namespace envoy-router --create-namespace \
82-
--set gateway.create=false \
83-
--set operator.watchNamespace=""
84-
```
72+
--version 0.1.0 --namespace ns-1 --create-namespace
8573
86-
**Install a Gateway in each namespace:**
74+
helm install envoy-router oci://ghcr.io/comet-ml/charts/envoy-router \
75+
--version 0.1.0 --namespace ns-2 --create-namespace
76+
```
8777

88-
```bash
89-
helm install envoy-router-gateway oci://ghcr.io/comet-ml/charts/envoy-router \
90-
--version 0.1.0 \
91-
--namespace ns-1 --create-namespace \
92-
--set gateway.create=true \
93-
--set gateway.allowedRouteNamespaces=Same \
94-
--set operator.watchNamespace=ns-1 # disable second operator — only one needed
78+
```
79+
ns-1: ALB-1 → Gateway (ns-1) → HTTPRoutes for pp-* in ns-1
80+
ns-2: ALB-2 → Gateway (ns-2) → HTTPRoutes for pp-* in ns-2
9581
```
9682
97-
> The operator uses the pod's namespace to find the local Gateway when `--gateway-namespace` is empty, so HTTPRoutes in `ns-1` attach to the Gateway in `ns-1` automatically.
83+
**ALB configuration:** one rule per ALB — forward `/*` to the Envoy Gateway service in that namespace. No per-pod rules needed.
9884
9985
## Development
10086

charts/envoy-router/templates/_helpers.tpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,3 @@
2222
{{- default "default" .Values.serviceAccount.name }}
2323
{{- end }}
2424
{{- end }}
25-
26-
{{- define "envoy-router.gatewayNamespace" -}}
27-
{{- default .Release.Namespace .Values.gateway.namespace }}
28-
{{- end }}
29-
30-
{{- define "envoy-router.operatorGatewayNamespace" -}}
31-
{{- default .Release.Namespace .Values.operator.gatewayNamespace }}
32-
{{- end }}

charts/envoy-router/templates/deployment.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ spec:
2525
imagePullPolicy: {{ .Values.image.pullPolicy }}
2626
args:
2727
- --gateway-name={{ .Values.operator.gatewayName }}
28-
- --gateway-namespace={{ include "envoy-router.operatorGatewayNamespace" . }}
28+
- --gateway-namespace={{ .Release.Namespace }}
2929
- --service-port={{ .Values.operator.servicePort }}
3030
- --pod-port={{ .Values.operator.podPort }}
31-
{{- if .Values.operator.watchNamespace }}
32-
- --watch-namespace={{ .Values.operator.watchNamespace }}
33-
{{- end }}
31+
- --watch-namespace={{ .Release.Namespace }}
3432
ports:
3533
- name: metrics
3634
containerPort: 8080

charts/envoy-router/templates/gateway.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: gateway.networking.k8s.io/v1
33
kind: Gateway
44
metadata:
55
name: {{ .Values.gateway.name }}
6-
namespace: {{ include "envoy-router.gatewayNamespace" . }}
6+
namespace: {{ .Release.Namespace }}
77
labels:
88
app.kubernetes.io/name: {{ include "envoy-router.name" . }}
99
app.kubernetes.io/instance: {{ .Release.Name }}

charts/envoy-router/templates/gatewayclass.yaml

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

charts/envoy-router/templates/clusterrole.yaml renamed to charts/envoy-router/templates/role.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
apiVersion: rbac.authorization.k8s.io/v1
2-
kind: ClusterRole
2+
kind: Role
33
metadata:
44
name: {{ include "envoy-router.fullname" . }}
5+
namespace: {{ .Release.Namespace }}
56
labels:
67
app.kubernetes.io/name: {{ include "envoy-router.name" . }}
78
app.kubernetes.io/instance: {{ .Release.Name }}
@@ -15,7 +16,6 @@ rules:
1516
- apiGroups: ["gateway.networking.k8s.io"]
1617
resources: ["httproutes"]
1718
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
18-
# controller-runtime leader election and event recording
1919
- apiGroups: ["coordination.k8s.io"]
2020
resources: ["leases"]
2121
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]

charts/envoy-router/templates/clusterrolebinding.yaml renamed to charts/envoy-router/templates/rolebinding.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
apiVersion: rbac.authorization.k8s.io/v1
2-
kind: ClusterRoleBinding
2+
kind: RoleBinding
33
metadata:
44
name: {{ include "envoy-router.fullname" . }}
5+
namespace: {{ .Release.Namespace }}
56
labels:
67
app.kubernetes.io/name: {{ include "envoy-router.name" . }}
78
app.kubernetes.io/instance: {{ .Release.Name }}
89
roleRef:
910
apiGroup: rbac.authorization.k8s.io
10-
kind: ClusterRole
11+
kind: Role
1112
name: {{ include "envoy-router.fullname" . }}
1213
subjects:
1314
- kind: ServiceAccount

charts/envoy-router/values.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,20 @@ serviceAccount:
99
create: true
1010
name: ""
1111

12-
# Gateway API resources created by this chart
12+
# Gateway resource created in the same namespace as the operator.
13+
# Uses the "eg" GatewayClass that Envoy Gateway installs automatically.
1314
gateway:
14-
# Set false if you manage GatewayClass/Gateway yourself
1515
create: true
16-
className: envoy-router
16+
className: eg
1717
name: envoy-router
18-
# Defaults to .Release.Namespace when empty
19-
namespace: ""
2018
port: 80
21-
# Namespaces allowed to attach HTTPRoutes: All | Same | Selector
22-
allowedRouteNamespaces: All
19+
# Same: only HTTPRoutes from this namespace attach (per-namespace model)
20+
allowedRouteNamespaces: Same
2321

2422
operator:
2523
gatewayName: envoy-router
26-
# Defaults to .Release.Namespace when empty
27-
gatewayNamespace: ""
2824
servicePort: 80
2925
podPort: 8080
30-
# Empty = watch all namespaces
31-
watchNamespace: ""
3226

3327
resources: {}
3428
nodeSelector: {}

0 commit comments

Comments
 (0)