Repository navigation
feat(gateway): Serve Edge listener services from serving backends - #1525
Conversation
Gateways are to serve a listener service from the backends in its EdgeListener's status. Their health gate matches a published decision on the backend's attachment UID, and the router probes a backend through its host-side link. Neither was in the status, so gateways would have had to read every provider namespace's EdgeAttachments. Core now copies the attachment's metadata.uid and status.hostLink into each status.backends entry. Both fields are optional and additive.
A NetworkService that names an EdgeListener had no backends: gateways and routers reported the listener pending, so its VIPs were never loaded or advertised. Gateways and galactic-router now take such a service's backends from the listener's status.backends entries that core reports serving. Core already decides readiness, lease, drain deadline and local-delivery exclusion, so neither re-checks EdgeAttachments. Each serving backend gets a Maglev slot on every gateway and a veth ServiceVIPBinding on its node. The router probes it through its host link and publishes the decision under the attachment's UID, so the existing health gate, failure policy and withdrawal paths apply unchanged. Gateways and routers watch EdgeListener status only where the API server serves the kind; elsewhere a listener service stays pending and every other service is unaffected. Their ClusterRoles grant read access to edgelisteners, and the gateway's RBAC preflight checks it when the kind is served.
|
First pass: pr-adversary returned VERDICT merge (no defect; warnings: CI was pending, and the datapath stays unproven until the stacked lab-test PR, so #1511 stays open). pr-conventions-reviewer returned VERDICT hold on two decisions, the landing order against draft PR #845 and the core-before-gateway rollout order. The human resolved both: #1525 lands before #845, and the documented rollout order is accepted. It also raised a warning on identifiers in the body and nits on the Rollout length and the stacked-PR link. Fix phase: the body was rewritten in plain words and Rollout cut to one sentence. The stacked-PR link is skipped because that PR does not exist yet. No code commits were needed. Second pass: pr-rereviewer returned VERDICT merge (summary and rollout confirmed fixed, link pending the follow-up PR, nits only). pr-conventions-reviewer returned VERDICT hold, re-raising the two human-resolved decisions and CI: every check on head 8d0ce9b passed, including Lint, Unit Tests, Unit Tests (root), E2E Tests, ci / Build and test and the publish-* image jobs. Auto-merge is enabled with the merge method, the only one the ruleset allows. The ruleset requires one approving review, code owner review and approval of the last push, so the PR waits for a human approval. |
ecv
left a comment
There was a problem hiding this comment.
Approve.
Listener services now resolve backends from the EdgeListener's status in the same namespace, with a tenant guard and tests, and the new RBAC is read-only. Nothing here is dangerous; follow-ups below.
- Tenant isolation holds:
listenerCandidateBackendslooks the listener up by the rule's own namespace plusedgeListenerRef.name, so another namespace's listener can never be named. A rule outside the gateway namespace goes pending (TestSelectRuleBackends_EdgeListener*covers the tenant case). Backends are never selected by label. - The guard is covered: without it the
tenantcase ofTestSelectRuleBackends_EdgeListenerUnavailableresolves to "EdgeListener not found" instead of the tenant refusal and fails. - New RBAC is
get/list/watchonedgelistenersfor the gateway and the router, nothing writable. The gateway preflight (watchedResources, withTestCheckWatchPermissionsupdated) covers it; the router preflight only logs, and the new entry has no test. - Existing services keep their behaviour: the selector path moved unchanged into
selectorCandidateBackends, and the sort and conflict drop still run for both paths. Only listener services change, from always-pending to resolved. Gateways and routers skip the watch when the CRD is not served, so a rollout ahead of the CRD is safe. - Health: only backends core reports
servingwith UID, node, host link and a plain IPv6 address are used; anything else is pending. When none serve, the listener is pending with a reason and the service has no backends. A listener rule's health-check target comes from the listener's UID and host link, so a recreated attachment gets a new probe identity.
Follow-ups:
- The same-namespace guard lives only in the controllers (
ruleIsTenant, which is off whenobjNSis empty); the CRD only enforces "exactly one of backendSelector and edgeListenerRef". Add a CEL or admission check so the API rejectsedgeListenerRefoutside the gateway namespace, as the type comment promises. - Gateways and routers trust
status.backendsand never re-check attachments, so if core stops reconciling a listener, a staleserving: truekeeps a dead backend in the Maglev table until a probe says otherwise. A listener service with nohealthCheckhas no such backstop. Consider requiring a health check, or core marking the status stale. - Add a test for the router's
edgelistenerspreflight entry and for the rule-owner contention path between a listener rule and a selector rule in one VPC.
Summary
Gateways never served a public listener, so the listener's addresses were never advertised. Gateways and routers now use the backends the listener reports as serving, stop sending new flows to one that drains, turns unready or loses its lease, and get read access to listeners. Related to #1511, which a stacked follow-up PR with the lab failover tests will close.
Rollout
Core must roll out before gateways and routers, and the gateway and router permissions ship with their images.
Test plan
task lint,task build,task test:unit,task test:e2eandtask docs:checkpass