Skip to content

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
bpalermo merged 6 commits into
mainfrom
fix/1635-one-load-assignment-per-name
Oct 10, 2026

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

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 the tcp:<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:

  1. Retention. Ownership is decided while the refresh's passes run, when the map holds only entries built from a live listing. The retention step runs afterwards and re-inserted the entry of a listing that had gone with an empty load assignment under the same name. So: HTTP listing gone while TCP (or UDP) stays; the mirror in a single refresh (TCP gone, HTTP appears); both gone and one back.
  2. TCP and UDP. The UDP pass asked only whether the HTTP entry held the name, so a service listed under TCP and UDP (and not HTTP) had two holders for as long as it was listed under both, with no retention involved.

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)

input published under the service name derived copies
HTTP listing gone, TCP (2 pods) live 2 0 0 2 0 0 2 0 2 2 2 2 0 2 2 0 ..., two versions tcp:<fqdn>, <fqdn>:18081, the quic: twin: 0 on all 32; udp: cluster: 0
TCP listing gone and HTTP (3 pods) appears in one refresh 0 0 0 0 3 0 0 0 3 3 0 ...
both gone, then TCP back 0 0 2 0 0 2 2 0 2 0 ... tcp:<fqdn>: 0 on all 32
TCP (2 pods) and UDP (1 pod) both live 1 2 1 1 1 1 ... 2 1 1 2 ...
HTTP listing gone, UDP (1 pod) live 0 1 1 1 1 0 0 1 1 0 ... udp: cluster: 0

The 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_proxy has no on-demand path to recover.

The rule

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 load assignment only under a name no other entry holds. Otherwise it holds none, like a port alias. This is applied to every retained entry on every refresh, because the live holder can appear after the entry was retained.

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:

  • the 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);
  • the 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, expected 10.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. main did 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 from main.

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

case test
HTTP lost, TCP stays (the issue), then past the grace TestHTTPListingLostWhileTCPStaysPublishesTheLiveLoadAssignment
TCP lost, HTTP stays TestTCPListingLostWhileHTTPStaysKeepsTheHTTPLoadAssignment (passed before too: the retained floor entry held none)
TCP replaced by HTTP in one refresh TestTCPListingReplacedByAnHTTPListingInOneRefresh
both lost; then TCP back; then HTTP back TestBothListingsLostPublishOneEmptyLoadAssignment
TCP and UDP both live; UDP lost; TCP lost TestTCPAndUDPListingsPublishOneLoadAssignment
HTTP lost, UDP stays TestHTTPListingLostWhileUDPStaysPublishesTheLiveLoadAssignment

Each 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, the udp: 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.

TestDuplicateLoadAssignmentNameIsReportedWithoutAnIssue drives the check directly on a non-pod duplicate (no cache input produces one any more), so the ERROR line stays pinned to carry no issue attribute.

TestRetainedHTTPEntryBesideALiveTCPEntryIsLoggedOnceAndCounted pinned one ERROR and a counter of 32 for the issue's input. It is now TestRetainedHTTPEntryBesideALiveTCPEntryIsNotADuplicate: 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=race on //agent/internal/xds/cache:cache_test, the full lint build, make format-check.

What an operator sees

  • aether_agent_snapshot_duplicate_resource_names_total no 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).
  • One new INFO line when a retained entry yields: retained entry publishes no load assignment of its own: another entry of the service publishes that name.
  • No name, metric or resource shape changes. No harness contract change.

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

bpalermo and others added 6 commits October 10, 2026 08:24
…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
@bpalermo
bpalermo merged commit 4a59a6a into main Oct 10, 2026
30 checks passed
@bpalermo
bpalermo deleted the fix/1635-one-load-assignment-per-name branch October 10, 2026 12: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

1 participant