Repository navigation
feat(edge): Advertise serving listener backends to gateways - #1522
Conversation
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
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
|
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. |
ecv
left a comment
There was a problem hiding this comment.
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.VPCequals the listener's ingress gVPC (backends.go), the advertisement takes the router, VRF ID and first export route target from that gVPC's ownBGPVRFInstanceon 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 guardcase att.Status.VPC != vpcis 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.
TestListenerUnpublishablecovers it. - Withdrawal:
withdrawIfdeletes on a UID and resourceVersion precondition andwithdrawGonespares 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.goupdated). - 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-listenerlabel, and the doc says so. Same follow-up as #1520 on admission scoping. - Follow-up:
applyAdvertisementupdates whatever sits atedge-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
|
Both points are addressed at 77b95bb.
The body now links #1511, and says the gateway eligibility check has to land before this reaches production. |
ecv
left a comment
There was a problem hiding this comment.
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 aBGPAdvertisementNameTakenEvent.TestListenerAdvertisementNameTakenandTestListenersAdvertisementcover it. - The merge from
fix/issue-1509-admissionbrings #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
scotwells
left a comment
There was a problem hiding this comment.
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.
|
Fixed in 9ee7a0b. Withdrawal now selects advertisements with the same ownership check as updates: the |
scotwells
left a comment
There was a problem hiding this comment.
Approved advertising serving backends in the listener’s ingress network. Withdrawal now preserves advertisements the listener no longer owns.
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
Related to #1509
Related to #1511