Repository navigation
fix(agent): a service's shared load assignment is published by exactly one of its entries, the one built from a live listing, so its endpoints no longer alternate while another listing's cluster is retained (#1635) - #1638
Merged
Merged
Conversation
…y one of its entries, the one built from a live listing, so its endpoints no longer alternate while another listing's cluster is retained (#1635) A service's h2 cluster, its TCP floor and its UDP floor share one load assignment, named after the service. The HTTP default entry, the TCP floor entry and the UDP floor entry of the cluster cache all name it, and one of them is meant to hold it. Two paths gave it two holders: - Ownership was decided while the refresh's passes ran, when the map holds only entries built from a live listing; the retention step then re-inserted the entry of a listing that had gone with an EMPTY load assignment under the same name. HTTP listing gone and TCP (or UDP) listing still there, or the mirror in one refresh (TCP gone, HTTP appears), or both gone and one back. - The UDP pass asked only whether the HTTP entry held the name, so a service listed under TCP and UDP had two holders for as long as it was. go-control-plane keeps one resource per name and which one is redrawn on every build. Measured in the cache over 32 refreshes with the HTTP listing gone and the TCP one live: the bare name published 2 0 0 2 0 0 2 0 2 2 ... endpoints with a new version each change, and the TCP floor's own-name copy, the h2 port alias's and the udp: cluster had NO endpoints on all 32, because the copies were taken from the retained entry's empty one. The rule now: a name's load assignment is held by one entry. Among entries built from a live listing, the first of HTTP, TCP, UDP. An entry retained after its listing went holds an empty one only under a name no other entry holds, and otherwise none (the shape of a port alias). It keeps its cluster and its vhost for the grace, which is what the retention is for; its cluster's subscription to the shared name resolves to the live entry's load assignment, as the floor cluster's already does for a service listed under both. The QUIC twins of a retained default entry and the udp: cluster read the shared load assignment from whichever entry holds it. The duplicate-name check of #1634 is silent for these inputs; its test, its comment and the runbook say so. Closes #1635 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
… its endpoints (#1635) Review of the previous commit. The udp: cluster read its endpoints from the entry that holds the service's shared load assignment and its application port from the entry serviceEntryLocked prefers (HTTP, then TCP). With an HTTP or a TCP entry retained beside a live UDP listing those are two entries, and two listings of one service need not register one port: the live UDP pod was dialed at the retained entry's port (10.2.3.1:8080 for a pod registered on 5353) for the grace. bareServiceHolderLocked returns the one holder, and the cluster and the predicate that decides whether it is published read both facts from it. Tests: every listing of the fixtures now registers its own port (HTTP 8080, TCP 9000, UDP 5353) and the udp: cluster is asserted by address and port in each sibling case, retained TCP beside live UDP included. A seeded random walk over one service's three listings, the grace, the dependency set and the QUIC twin (from the review) checks the holder rule and what is derived from it after every refresh. The duplicate-name check is driven directly on a non-pod duplicate, which no cache input produces any more, so that the line is still pinned to carry no issue attribute. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…alermo/aether into fix/1635-one-load-assignment-per-name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1635
What was wrong
A service's h2 cluster, its TCP floor and its UDP floor share one load assignment, named after the service (
demo/db). The HTTP default entry, the TCP floor entry and the UDP floor entry of the agent's cluster cache all name it, and exactly one is meant to hold it (proposal 037, "the bare-name CLA is owned by the HTTP default entry when the service has one, else by thetcp:<fqdn>entry"). When both listings are live there is one holder, not two equal ones: the HTTP entry holds it and the TCP entry holds none. The #1634 comment that said "two equal load assignments" was wrong and is corrected here.Two paths gave the name two holders:
go-control-plane keeps one resource per name, and which one is redrawn on every build.
Measured on
main(snapshot cache, 32 consecutive refreshes each)2 0 0 2 0 0 2 0 2 2 2 2 0 2 2 0 ..., two versionstcp:<fqdn>,<fqdn>:18081, thequic:twin: 0 on all 32;udp:cluster: 00 0 0 0 3 0 0 0 3 3 0 ...0 0 2 0 0 2 2 0 2 0 ...tcp:<fqdn>: 0 on all 321 2 1 1 1 1 ... 2 1 1 2 ...0 1 1 1 1 0 0 1 1 0 ...udp:cluster: 0The second column is the issue. The third was not in it and is worse: the copies are taken from "whichever entry holds the name, HTTP first", which found the retained entry's empty one every time. For the 90 s grace the TCP floor of a service that had just lost its HTTP listing had no endpoints at all, and
tcp_proxyhas no on-demand path to recover.The rule
A name's load assignment is held by one entry.
What "right" is while the HTTP entry is retained and the TCP entry is live: the live listing's endpoints. The retained h2 cluster and its outbound vhost stay for the whole grace, which is what the retention exists for (a request to it is neither a route-table 404 nor an on-demand stall). The cluster's subscription to the shared name resolves to the live entry's load assignment, the same sharing the floor cluster already has with the HTTP entry when both listings are live. The alternative, keeping the empty one, is what starved the live TCP floor.
The retention itself is unchanged: same grace, same entries kept, same pruning. With both listings gone, one empty load assignment is published, as before.
Two readers followed the holder instead of a preferred entry, so nothing derived goes empty or disappears:
quic:twins of a retained default entry (their own-name copies would otherwise have been removed from EDS, and Envoy keeps the last endpoints of a removed EDS resource);udp:cluster and the predicate that decides whether it is published. It takes both its endpoints and its application port from the one holder entry (bareServiceHolderLocked). The first commit of this pull request took only the endpoints from it and left the port with the preferred entry; the adversarial review showed a live UDP pod registered on 5353 dialed at a retained HTTP entry's 8080 for the grace (10.2.3.1:8080, expected10.2.3.1:5353), and the same with a retained TCP entry. Fixed in the second commit.Known consequence, not changed here
While an HTTP entry is retained beside a live TCP listing, the retained h2 cluster resolves to the TCP listing's pods on every build, for up to the 90 s grace.
maindid so on about half the builds (whenever the populated load assignment won the draw) and published no endpoints on the others. A pod is listed under the one protocol it declares, so those are pods that did not declare HTTP: a request through the retained cluster is an h2 mTLS connection to such a pod's mesh inbound. What that pod's inbound does with it is inferred from the inbound filter chains (agent/internal/xds/proxy/ingress.go), not run through a proxy. It is the same sharing a service listed under both protocols already has in the other direction (its TCP floor is sent the HTTP listing's pods), and giving each cluster the membership of its own listing is a larger change than this one.The same holds for the
udp:cluster of a service listed under HTTP (or TCP) and UDP while both are live: it dials the holder's endpoints at the holder's port, which is the HTTP (or TCP) listing's. Unchanged frommain.Tests
All in
agent/internal/xds/cache/bare_cla_owner_1635_test.go, each over 32 builds, each asserting the published count on every build, one holder per name in the cache, one version (no EDS push), and a silent duplicate-name check. Seen red against the unchanged code (the table above is their output).TestHTTPListingLostWhileTCPStaysPublishesTheLiveLoadAssignmentTestTCPListingLostWhileHTTPStaysKeepsTheHTTPLoadAssignment(passed before too: the retained floor entry held none)TestTCPListingReplacedByAnHTTPListingInOneRefreshTestBothListingsLostPublishOneEmptyLoadAssignmentTestTCPAndUDPListingsPublishOneLoadAssignmentTestHTTPListingLostWhileUDPStaysPublishesTheLiveLoadAssignmentEach listing of these fixtures registers its own port (HTTP 8080, TCP 9000, UDP 5353), and the
udp:cluster is asserted by address and port, so a reader that takes endpoints from one entry and the port from another fails them.TestOneHolderPerNameHoldsOverARandomWalk(from the review, 12 seeds of 40 steps, about 3 s): a seeded walk over one service's three listings, time jumps across the grace, the dependency set and the QUIC twin. After every refresh and four unchanged rebuilds: one holder per name, every EDS cluster's load assignment published, the shared name carrying the first live listing's rows, no live floor empty, theudp:cluster on the holder's endpoints and port, every copy equal, the h2 cluster retained for exactly its grace, no version moving, the check silent.TestDuplicateLoadAssignmentNameIsReportedWithoutAnIssuedrives the check directly on a non-pod duplicate (no cache input produces one any more), so the ERROR line stays pinned to carry noissueattribute.TestRetainedHTTPEntryBesideALiveTCPEntryIsLoggedOnceAndCountedpinned one ERROR and a counter of 32 for the issue's input. It is nowTestRetainedHTTPEntryBesideALiveTCPEntryIsNotADuplicate: no line, counter 0, the two live endpoints on every build.Mutation checks (each reverted; none left in the tree), all killed: the UDP pass looking at the HTTP entry only; the retained entry never yielding; yielding only when first retained; the live names not seeded; the twins reading the entry's own load assignment; the
udp:cluster taking its port from the preferred entry.Run locally:
//agent/internal/xds/...and//agent/test/...,--config=raceon//agent/internal/xds/cache:cache_test, the full lint build,make format-check.What an operator sees
aether_agent_snapshot_duplicate_resource_names_totalno longer moves, and the ERROR line no longer names the endpoint type and a service, when a workload changes protocol or one of a service's listings empties. The runbook lists one known input of the check now (two sandboxes of the same pod).retained entry publishes no load assignment of its own: another entry of the service publishes that name.Not measured
Nothing here was run against a proxy or a cluster. What the proxy does with the alternating resource, and what a request through the retained h2 cluster to the live listing's pods gets, are inferred from the configuration, not observed.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr