You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 337c577
Browse filesBrowse the repository at this point in the historyBrowse files
Rework fast-path provisioning to per-Gateway data-plane Deployment
Address review feedback on gke-labs#624:
- Provision a dedicated data-plane Deployment per Gateway in pkg/provisioning/singlepod selecting its own LoadBalancer Service.
- Support data-plane mode in GARI with GatewayFilter and DisableStatusUpdates.
- Derive Service ports from Gateway effective listeners (including ListenerSets).
- Gate Programmed condition on Deployment availability and Service LoadBalancer address assignment without fallback.
- Implement label-based orphan sweeping and deletion cleanup via GatewayDeleteHandler.OnGatewayDeleted.
- Drop dynamic listener manager, port allocator, scoped proxy, and Gateway finalizer.
Fixesgke-labs#620
Copy file name to clipboardExpand all lines: .agents/skills/implement-conformance-test/journal/httproute-multiple-gateways.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,25 +7,27 @@
7
7
8
8
## 2. Issue / Failure Analysis
9
9
-**Observed Behavior**: In single-pod fast-path mode, all Gateways previously shared a single `default/gari-proxy` LoadBalancer Service and shared proxy ports (`:8000`, `:8443`), routing solely by Host header. Gateways could not be isolated when two Gateways had overlapping catch-all paths (e.g., both having `/` on port 80).
10
-
-**Root Cause**: Fast-path mode lacked per-Gateway LoadBalancer Service provisioning and distinct pod port allocation for listener isolation.
10
+
-**Root Cause**: Fast-path mode lacked per-Gateway data-plane Deployment provisioning and per-Gateway LoadBalancer Services for traffic and listener isolation.
11
11
12
12
## 3. Implementation / Fix Strategy
13
13
-**Approach**:
14
-
1. Implemented per-Gateway `type: LoadBalancer` Service provisioning in `pkg/provisioning/singlepod` with deterministic naming (`gari-gw-<hash>`), Gateway identifying labels, and pod port allocation in range `20000-29999`.
15
-
2. Maintained stable port allocations across restarts seeded from existing Services, and implemented clean finalizer/GC cleanup upon Gateway deletion.
16
-
3. Added `ListenerAddressProvider` dynamic listener management in `pkg/gari` and scoped proxy routing in `pkg/proxy` so connections arriving on a dynamic listener port are evaluated only against that Gateway's listeners, certificates, and routes.
17
-
4. Preserved shared-listener fallback when no `ListenerAddressProvider` is configured (for embedders like `snigateway`).
18
-
5. Removed the shared `gari-proxy` Service from `k8s/controller.yaml`, updated RBAC for Service CRUD, and updated e2e harness and tests to use Gateway `status.addresses`.
19
-
6. Enabled `tests.HTTPRouteMultipleGateways` in `tests/e2e/conformance_test.go`.
14
+
1. Implemented per-Gateway Deployment and `type: LoadBalancer` Service provisioning in `pkg/provisioning/singlepod` with deterministic naming (`gari-gw-<hash>`), Gateway identifying labels (`gateway.networking.k8s.io/gateway-name`, `gateway.networking.k8s.io/gateway-namespace`, `app.kubernetes.io/managed-by: gari-singlepod`), and service selector matching its dedicated Deployment.
15
+
2. Derived Service ports dynamically from effective listeners (including ListenerSets).
16
+
3. Added data-plane mode (`--dataplane-mode`, `--gateway-namespace`, `--gateway-name`, `DisableStatusUpdates: true`) so each per-Gateway pod reconciles and serves only its designated Gateway without colliding on Host headers or writing status back.
17
+
4. Gated Gateway `Programmed` condition on the provisioned Deployment being ready/available and the Service having an assigned LoadBalancer address (with no fallback).
18
+
5. Implemented label-based orphan sweeping and deletion cleanup via `GatewayDeleteHandler.OnGatewayDeleted` instead of cross-namespace finalizers.
19
+
6. Removed the shared `gari-proxy` Service from `k8s/controller.yaml`, granted Deployment and Service CRUD permissions in ClusterRole RBAC, and updated e2e harness and tests to use Gateway `status.addresses`.
20
+
7. Enabled `tests.HTTPRouteMultipleGateways` in `tests/e2e/conformance_test.go`.
-**Unit Tests**: Added port allocator tests, singlepod address provider tests, and scoped proxy routing tests; verified with `ap test`.
39
+
-**Unit Tests**: Added unit tests for per-Gateway Deployment & Service provisioning, effective listener ports, readiness gating, and orphan sweeping; verified with `ap test` and `ap lint`.
flag.StringVar(&controllerNamespace, "controller-namespace", defaultNs, "The namespace of the controller where per-Gateway Services are provisioned.")
46
+
defaultImg:=os.Getenv("GARI_IMAGE")
47
+
ifdefaultImg=="" {
48
+
defaultImg=singlepod.DefaultDataplaneImage
49
+
}
50
+
51
+
flag.StringVar(&controllerNamespace, "controller-namespace", defaultNs, "The namespace of the controller where per-Gateway Services and Deployments are provisioned.")
52
+
flag.BoolVar(&dataplaneMode, "dataplane-mode", false, "Run in data-plane mode serving a single Gateway.")
53
+
flag.StringVar(&gatewayNamespace, "gateway-namespace", "", "The namespace of the Gateway to serve in data-plane mode.")
54
+
flag.StringVar(&gatewayName, "gateway-name", "", "The name of the Gateway to serve in data-plane mode.")
55
+
flag.StringVar(&dataplaneImage, "dataplane-image", defaultImg, "The container image to use for provisioned per-Gateway data-plane Deployments.")
39
56
flag.StringVar(&opts.MetricsAddr, "metrics-bind-address", opts.MetricsAddr, "The address the metric endpoint binds to.")
40
57
flag.StringVar(&opts.HealthProbeBindAddress, "health-probe-bind-address", opts.HealthProbeBindAddress, "The address the probe endpoint binds to.")
41
58
flag.StringVar(&opts.ProxyAddr, "proxy-bind-address", opts.ProxyAddr, "The address the proxy binds to.")
0 commit comments