Skip to content

feat(gateway): Serve Edge listener services from serving backends - #1525

Merged
privateip merged 2 commits into
mainfrom
fix/issue-1511
Nov 29, 2026
Merged

privateip merged 2 commits into
mainfrom
fix/issue-1511

Conversation

@privateip

@privateip privateip commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Gateways and routers derive the same backends and owners from a listener's serving backends, and a backend that stops serving loses its binding
  • The router probes a listener backend through its host link and publishes the result under the attachment's UID
  • task lint, task build, task test:unit, task test:e2e and task docs:check pass
  • Lab failover tests with two provider instances (stacked follow-up)

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.
@privateip privateip self-assigned this Nov 29, 2026
@privateip
privateip marked this pull request as ready for review November 29, 2026 22:28
@privateip
privateip requested a review from a team as a code owner November 29, 2026 22:28
@privateip
privateip enabled auto-merge November 29, 2026 22:28
@privateip

Copy link
Copy Markdown
Contributor Author

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 task docs:check as unverified locally; the passing Documentation check on this head settles that. Its nit on "its" in the summary is applied in the body.

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 ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: listenerCandidateBackends looks the listener up by the rule's own namespace plus edgeListenerRef.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 tenant case of TestSelectRuleBackends_EdgeListenerUnavailable resolves to "EdgeListener not found" instead of the tenant refusal and fails.
  • New RBAC is get/list/watch on edgelisteners for the gateway and the router, nothing writable. The gateway preflight (watchedResources, with TestCheckWatchPermissions updated) 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 serving with 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 when objNS is empty); the CRD only enforces "exactly one of backendSelector and edgeListenerRef". Add a CEL or admission check so the API rejects edgeListenerRef outside the gateway namespace, as the type comment promises.
  • Gateways and routers trust status.backends and never re-check attachments, so if core stops reconciling a listener, a stale serving: true keeps a dead backend in the Maglev table until a probe says otherwise. A listener service with no healthCheck has no such backstop. Consider requiring a health check, or core marking the status stale.
  • Add a test for the router's edgelisteners preflight entry and for the rule-owner contention path between a listener rule and a selector rule in one VPC.

@privateip
privateip merged commit 15d72b2 into main Nov 29, 2026
28 checks passed
@privateip
privateip deleted the fix/issue-1511 branch November 29, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants