Skip to content

feat(edge): Advertise serving listener backends to gateways - #1522

Merged
privateip merged 10 commits into
fix/issue-1509-admissionfrom
fix/issue-1509-publish
Nov 29, 2026
Merged

privateip merged 10 commits into
fix/issue-1509-admissionfrom
fix/issue-1509-publish

Conversation

@privateip

@privateip privateip commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A gateway can deliver to a listener backend only when it can resolve the backend's address in the ingress network, and nothing advertises that address.

Core now advertises each serving backend's address into the ingress network, in the same shape as an Edge route, and withdraws it once the backend stops serving.

These advertisements carry their own label, so the router sends them without the node forwarding gate that Edge routes need. A backend cut off from the API stays advertised until core withdraws it, so the gateways' own eligibility check must land before this reaches production.

Test plan

  • A serving backend's address is advertised, and is withdrawn when the backend stops serving or goes away
  • The router advertises these routes without a gate, and its garbage collection leaves them alone
  • Lint, unit tests, envtest and the Kind e2e pass

Related to #1509
Related to #1511

Core now writes a BGPAdvertisement in galactic-system for the address of
each serving listener backend, so the gateways can resolve the backend's
uSID. It has the shape of an edge route's: the router, VRF ID and first
export route target of the ingress gVPC's BGPVRFInstance on the
backend's node, End.DT46, and the EVPN family. It is named from the
attachment's UID and annotated with the listener and attachment.

It is labelled with the new galactic.datumapis.com/edge-listener label,
not edge-route, so galactic-router advertises it with no forwarding gate,
as the listener has none; router GC finds no netns annotation on it and
never reclaims it. Tests pin both. Two more labels, a hash of the
listener's namespace and name and the gVPC's identifier, let core select
a listener's advertisements, and keep an ingress gVPC with a /128 in it
from being reclaimed.

A backend serves only once its advertisement can be built: until its
gVPC's VRF on its node names a router and an export route target it is
not serving, and Programmed is not BackendsReady while no backend is.

Core withdraws the advertisement, on UID and resourceVersion
preconditions, once the backend stops serving (Ready cleared, drain
deadline passed, lease released), its attachment goes or its listener
is gone.

Refs #1509
@privateip privateip self-assigned this Nov 29, 2026
@privateip
privateip added this pull request to stack #1524 November 29, 2026 03:43
@privateip privateip changed the title feat(edge): Publish the /128 of each serving listener attachment feat(edge): Advertise serving listener backends to gateways Nov 29, 2026
Programmed's message blamed the VRF for every eligible backend that was
not published, including one whose attachment address is not a plain
IPv6 address. desiredAdvertisement now returns the cause: the address,
a missing BGPVRFInstance, or one that names no router or export route
target. A backend in another gVPC than the listener's says so too.
Programmed's message names the first few backends and their causes.

Withdrawing a deleting listener's /128s needs no change: the finalizer
deletes its NetworkServices, waits until they are gone, and only then
withdraws its /128s, and a listener removed without its finalizer keeps
them while any of its NetworkServices exists.

Refs #1509
@privateip

Copy link
Copy Markdown
Contributor Author

Review verdicts at head c3e017e: the correctness re-review says merge, and the conventions review says merge.

The status message now names why a backend's address cannot be published: an address that is not plain IPv6, a missing VRF, a VRF with no router or export route target, or a backend in another network. It no longer blames the VRF for a bad address. The re-review confirmed that the new test fails when the message regresses, and the listener envtests pass at this head.

The commit message for that fix mentions the listener finalizer, which lands in the next pull request in the stack. At this layer core writes no gateway services yet, so there is no teardown order to protect.

@privateip
privateip marked this pull request as ready for review November 29, 2026 04:55
@privateip
privateip requested a review from a team as a code owner November 29, 2026 04:55
@privateip
privateip requested a review from scotwells November 29, 2026 04:55

@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.

Request changes.

The guard that keeps a backend in another VPC out of a listener's ingress gVPC (case att.Status.VPC != vpc in backends.go) has no test: nothing puts a backend in a different gVPC and asserts it gets no advertisement. That is the isolation between providers, and it should be pinned before this is wired. The rest looks right.

Core advertises each serving backend's /128 only into the listener's own ingress gVPC VRF and withdraws it on stop, drain, attachment removal or listener removal. Nothing changes in production on merge: the reconciler only does work for providers with an ingress identity (needs infra to set --edge-ingress-identity), and the galactic release moves prod only on an infra pin. Checks at c3e017e are green (Unit Tests, E2E, Lint, Manifests). Repo is public, nothing site-specific here. Not stacked on #1520 directly: base is fix/issue-1509-admission (#1521), which sits on #1520, and #1523 sits on this one. #1521 currently has a CHANGES_REQUESTED review from scotwells; this PR should not merge before it.

  • Isolation: a backend serves only if att.Status.VPC equals the listener's ingress gVPC (backends.go), the advertisement takes the router, VRF ID and first export route target from that gVPC's own BGPVRFInstance on the backend's node, and the VPC identifier is a label that also holds the ingress gVPC from reclaim. A backend in another VPC gets a reason in Programmed and no advertisement. I found no envtest that puts a backend in a different gVPC and asserts no advertisement; the guard case att.Status.VPC != vpc is unguarded by a test. Follow-up: add one, then mutate it out.
  • Fail closed: a missing VRF, no router or export RT, or a non-plain-IPv6 address stops the backend serving instead of publishing something partial. TestListenerUnpublishable covers it.
  • Withdrawal: withdrawIf deletes on a UID and resourceVersion precondition and withdrawGone spares a listener recreated under the same name (matched by UID). Selecting by name hash plus namespace/name annotation is sound. Router GC leaves these alone (gc_test.go, edgegate_test.go updated).
  • No forwarding gate: these advertisements bypass the node forwarding gate, so a backend on a node cut off from the API stays advertised until core can withdraw it. The PR defers this to gateway eligibility checks; nothing consumes the routes until #1523 writes NetworkServices, but the gateway check must land before the stack is pinned in prod. Follow-up: link the issue for it in the body.
  • RBAC: no new rules; the existing BGPAdvertisement Role now also covers the edge-listener label, and the doc says so. Same follow-up as #1520 on admission scoping.
  • Follow-up: applyAdvertisement updates whatever sits at edge-listener-<attachment UID> without checking it carries the listener label; unreachable unless someone else writes that name.
  • Teammates: none reviewed this PR.

# Conflicts:
#	docs/edge/provider-contract.md
#	internal/edge/listener/reconciler.go
#	internal/edge/listener/setup.go
A listener attachment whose status.vpc is another gVPC than the
listener's ingress gVPC must never serve or be published. The new
envtest gives both gVPCs a VRF on the node, so only that check stands
between the attachment and publication, moves a published backend into
the other gVPC, and asserts it is withdrawn, is not serving, is not
published again over a window, and that Programmed names the gVPC.
Deleting the check makes the test fail with the /128 still published.

Refs #1509
applyAdvertisement updated whatever object sat at a backend's
advertisement name, edge-listener-<attachment UID>, without checking it
was a listener's. Core now updates an object there only if it carries
galactic.datumapis.com/edge-listener and the listener's
galactic.datumapis.com/edge-listener-key. Otherwise the backend does not
serve, Programmed names the object, and core records a
BGPAdvertisementNameTaken Event on the listener, as it does for a
NetworkService name another object holds.

Refs #1509
@privateip

Copy link
Copy Markdown
Contributor Author

Both points are addressed at 77b95bb.

  • TestListenerOtherGVPC puts a backend in another gVPC that has its own VRF on the node, so only the guard stops publication. It asserts the backend never serves, Programmed names the cause, and no advertisement appears. With the guard removed it fails with "timed out waiting for the /128 of ea-a to be withdrawn".
  • Core no longer updates or adopts an advertisement at its name unless it carries the listener's labels. Such a backend does not serve, and core records an Event and names the object in Programmed.

The body now links #1511, and says the gateway eligibility check has to land before this reaches production.

@privateip
privateip requested a review from ecv November 29, 2026 14:09
ecv
ecv previously approved these changes Nov 29, 2026

@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.

My hold is addressed. TestListenerOtherGVPC gives both gVPCs a VRF on the node, publishes the backend, moves its attachment to the other gVPC and asserts the advertisement is withdrawn and never returns, with Programmed naming the gVPC. Only the att.Status.VPC != vpc guard stands between that attachment and publication, so removing it fails the test.

  • The adoption follow-up is fixed too: an object at edge-listener-<attachment UID> without the listener label and this listener's key is neither updated nor counted as serving, and gets a BGPAdvertisementNameTaken Event. TestListenerAdvertisementNameTaken and TestListenersAdvertisement cover it.
  • The merge from fix/issue-1509-admission brings #1521's changes, which are reviewed there. #1521 still carries a CHANGES_REQUESTED review, so this should not merge before it.

Follow-ups:

  • The body says the gateways' eligibility check must land before this reaches production, since these advertisements skip the forwarding gate. Link the issue that tracks it, so the infra pin can be held on it.

Brings up the tests that pin a listener backend's lease skew allowance
and its instance checks, and the error log when EdgeListener is not
served. TestListenerBackendInstance now uses this layer's fixture and
gives both of its nodes a VRF, since a backend here serves only once
its address can be published; that leaves the instance checks as the
only reason its mismatched attachments do not serve.

Refs #1509
@privateip
privateip requested review from a team and ecv November 29, 2026 15:27
ecv
ecv previously approved these changes Nov 29, 2026

@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.

Merge of fix/issue-1509-admission only: it brings #1521's new lease and instance tests and the not-served log line, reviewed there. This PR's own commits are unchanged since my last approval.

@scotwells scotwells 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.

Please use the same ownership check for withdrawal as for updates. listenerAdvertisements selects by listener key and annotation but does not require the edge-listener label. If that label is removed, core refuses to update the advertisement, then deletes it as unwanted. Please test that the object survives reconciliation and listener deletion.

Core refused to update an advertisement without the edge-listener label,
but still selected it for withdrawal by listener key and annotation, so
removing that label made core delete the object as unwanted.

Withdrawal now uses the same ownership check as updates: the
edge-listener label and the listener's key label.
@privateip

Copy link
Copy Markdown
Contributor Author

Fixed in 9ee7a0b. Withdrawal now selects advertisements with the same ownership check as updates: the edge-listener label and the listener key label. TestListenerUnlabelledAdvertisementKept removes the label and checks that the advertisement survives both a pass that would withdraw it and deletion of the listener. It fails without the fix. The provider contract now says such an object is never withdrawn.

@privateip
privateip requested a review from scotwells November 29, 2026 17:06

@scotwells scotwells 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.

Approved advertising serving backends in the listener’s ingress network. Withdrawal now preserves advertisements the listener no longer owns.

@privateip
privateip merged commit 81e9f5b into main Nov 29, 2026
30 checks passed
@privateip
privateip deleted the fix/issue-1509-publish branch November 29, 2026 21:27
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.

3 participants