Repository navigation
fix(xds): alias the ODCDS authority on the mesh port, and re-seed the demand set on a fresh xDS stream (#682) - #698
Merged
Conversation
… the registry endpoint port (#682) #691 published a cold-path alias cluster "<fqdn>:<port>" so the ODCDS catch-all's cluster_header ":authority" always names a cluster the agent can actually publish. It derived that port from endpoints[0].GetPort() — the REGISTRY endpoint port, which is the APPLICATION port (endpoint.aether.io/port, default 8080). That is not the port a client dials. Mesh DNS answers a portless A record for the mesh VIP Service, and every mesh VIP Service advertises exactly one port: meshconst.ProxyOutboundPort (18081), synthesized by the registrar's Service generator (MeshPort), matched by the CNI's capture dport rule and by the cap_http route domains. So the authority the catch-all sees in production is "<fqdn>:18081" — never the app port — while the alias #691 published was "<fqdn>:8080". Deployment validation on talos-main (rev194, 2026-09-05) confirmed it: the only port-suffixed echo cluster present on a node was echo.aether-test.aether.internal:8080, and no ":18081" cluster existed anywhere in the fleet — the exact name that stalled for 5m10s ("cm odcds: on-demand discovery for cluster echo.aether-test.aether.internal:18081 timed out"). The demand-set-shrink test passed only because #691's TTL exemption kept echo in the dependency set, so the ":18081" path was never exercised. Publish an alias for every port an ODCDS authority can legitimately carry that has no per-port cluster of its own: the mesh port AND the default/application port (the default entry's vhost claims the latter as a host-match domain, so a client dialing it must find a cluster too). A port that IS a real advertised port keeps its own port-filtered per-port cluster — the whole-service alias never shadows it. Order is deterministic (mesh port first) because map order is protocol-visible (#135). TestODCDS_DefaultPortAuthorityIsAnsweredInOnePush now covers both spellings; the new "mesh Service port differs from the app port" case reproduces production (app port 8080, dialed port 18081) and fails on the pre-fix tree with exactly the deployment symptom: map[...]{"echo.aether-test.aether.internal", "…:8080"} does not contain "echo.aether-test.aether.internal:18081" TestLoadClustersFromRegistry_MultiPort gains the mesh-port alias assertions, and TestLoadClustersFromRegistry_MeshPortServedAsRealPort pins the no-shadowing rule. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…g for a periodic tick (#682) Deployment validation of #691 on talos-main (rev194, 2026-09-05) found a ~20s echo outage after every agent restart on the nodes with no local replica: w01: CNI conflist re-assert loop started 13:34:46.317Z observed undeclared upstream (ODCDS miss) echo 13:35:05.052Z (+19s) w03: 13:35:11.650Z -> 13:35:31.669Z (+20s) with prober http_error +130 (w01) / +127 (w03) inside the window, then flat, and the AetherProberHTTPErrorBurst alert firing and resolving. The agent is not slow. Its xDS socket was accepting 1.8s after the anchor (13:34:48.125Z); PreListen did not stall (no "registry watch cache not complete in time", no registry error), the catalog was healthy (no "rejecting on-demand request for unknown service"), and no TTL expiry fired. The access logs pin the outage precisely: exactly 133 x 503 cluster_not_found/NC per node, echo only (uds-echo and uds-cr-echo served 200 throughout), 10 rps to zero at 13:34:51 and back at 13:35:05, request durations capped at 2003ms — the on_demand filter's 2s timeout, ~7 rounds of it. So Envoy WAS trying, and the agent's onDeltaRequest callback saw nothing for 14.05s (w01) / 14.67s (w03). Mechanism: the observed half of the dependency set is process-local memory, so a restarted agent's first snapshot legitimately drops every ODCDS-acquired upstream — which is meant to cost one round trip, except a reconnecting Envoy never re-asks. markStreamFresh() puts every requested resource back into "waiting for server" and CLEARS the pending-add set, and the first request of the new stream carries initial_resource_versions only for resources it HOLDS plus resource_names_subscribe only for names added since. A name it is still waiting on is in NEITHER field, and updateSubscriptionInterest dedupes every later re-subscribe for a name already in requested_resource_state_. Nothing reaches the new agent until Envoy's 15s init-fetch timeout tears that state down and the next request re-subscribes from scratch — hence 14-15s, and hence the agent logging nothing at all for the whole outage. The evidence the agent was ignoring is in the same handshake: initial_resource_versions is the proxy stating, in the protocol, exactly which clusters it is still running on. Re-seed the node dependency set from it on the first request of every delta CDS stream (resumeHeldClusters), so the demand set is recovered BEFORE the first snapshot push and the upstream never leaves the snapshot at all. Restored entries are ordinary TTL'd observations, not live-subscription pins: an upstream the proxy has stopped using still ages out, so demand scoping still shrinks after a restart. They are also not counted as ODCDS misses — the proxy is not asking for something new, the agent is recovering demand it had already granted, and counting them would drown the miss metric (the signal to promote an upstream to an annotation) in one burst per restart. Only plain mesh service clusters are accepted, "<svc>.<ns>.<domain>" with an optional ":<port>" suffix: per-pod app_/health_ clusters, the "tcp:" floor clusters (a lenient match would mint keys like "ns/tcp:svc") and the passthrough cluster are not demand-set entries, and a held name whose service has left the catalog is skipped silently rather than counted as a rejection. Tests: TestOnDemandObserver_ResumesHeldClustersOnAFreshStream (the reconnect handshake with NO named subscribe at all, plus the name filtering and the no-pin rule), TestOnDemandObserver_ResumeIsIdempotentAndFirstRequestOnly, and TestRestoreDependency_AnsweredInTheFirstPushAndStillDecays (the requested authority is in the FIRST push after a restart, and still decays). All three fail with the resume pass stubbed out. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
#691 stopped expiring an observed dependency the node's proxy still holds a live on-demand subscription for. The exemption's entire effect is that nothing happens — no "expired observed upstreams", no cluster drop, no ODCDS re-warm — and its only trace was a Debug line, so the deployment validator had no way to tell a working exemption from a demand set that simply never aged. Add aether.agent.upstreams.ttl_refreshed, incremented per exempted entry per prune pass alongside the existing aether.agent.upstreams.* instruments, and nil-receiver-safe like the rest of cachemetrics (a no-op for n <= 0, so a prune pass that exempted nothing records nothing). Raise the accompanying log to Info for the same reason: it fires at most once per prune tick and only when an entry actually crossed its TTL. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Sep 5, 2026
bpalermo
added a commit
that referenced
this pull request
Sep 5, 2026
…ts warm (#701) (#702) A full agent+proxy replacement (every Helm upgrade) on a node with no local replica of an observed-only upstream costs one bucket of 503s (~5s, +57/+65 prober http_error on w01/w03 at the rev195 roll): the fresh proxy holds no clusters for the #698 re-seed to read, and the fresh agent's observed demand set is empty, so the first requests take the cold ODCDS path. Persist the OBSERVED half of the node dependency set to the agent's local storage directory (state/observed-upstreams.json, protojson of the new aether.agent.v1.ObservedUpstreams, atomic write) on every change, debounced 1s, plus a synchronous flush on shutdown; restore it once in configureSnapshotCache, before the watch filter and the first snapshot, so a replaced agent's first push already carries the clusters its node was using. Restored entries keep their original expires_at (never a fresh TTL), are ordinary observations rather than live-subscription pins, count as observed but not as misses, and union with the proxy's held-cluster re-seed. A missing, corrupt or unreadable file falls back to the cold path and never fails the agent. New counter aether.agent.upstreams.restored; one INFO line naming the restored keys (count only past 50). The file sits in a state/ subdirectory because storage.loadAll parses every top-level *.json in that directory as a CNI pod record and the ghost sweep would prune it. Edition 2024 proto: no gRPC service, no dynamo annotations. No chart change: the directory is already mounted read-write. Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Fable 5.1 <[email protected]>
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.
Follow-up to #691. Deployment validation on talos-main (rev194, 2026-09-05 13:34Z) confirmed the stall fix works — two deliberate demand-set shrinks produced 0 ODCDS stalls and 0 prober errors on the two no-local-replica nodes (w01/w03), against +133/+134 at the 09-05 teardown — but surfaced two defects. Both are fixed here, one commit each, plus the observability gap that made the TTL half unverifiable.
Commit 1 — the alias was built from the wrong port
buildDefaultPortAliasLockedderived the alias port fromendpoints[0].GetPort(): the registry endpoint port, which is the application port (endpoint.aether.io/port, default 8080). That is not a port any client dials.Mesh DNS answers a portless A record for the mesh VIP Service, and every mesh VIP Service advertises exactly one port —
meshconst.ProxyOutboundPort(18081), synthesized by the registrar's Service generator (MeshPort), matched by the CNI's capturedportrule, and claimed by thecap_httproute domains. So the authority the ODCDS catch-all actually sees in production is<fqdn>:18081.Validation found exactly that: the only port-suffixed echo cluster present on w01 was
echo.aether-test.aether.internal:8080, and no:18081cluster existed on any node — the exact name that stalled for 5m10s on 09-05:The shrink test passed only because commit 2 of #691 (the TTL exemption) kept echo in the dependency set, so the
:18081path was never exercised.Publish an alias for every port an ODCDS authority can legitimately carry that has no per-port cluster of its own: the mesh port and the default/application port (the default entry's own vhost claims the latter as a host-match domain). A port that IS a real advertised port keeps its own port-filtered per-port cluster — the whole-service alias never shadows it. Alias order is deterministic because map order is protocol-visible (#135).
TestODCDS_DefaultPortAuthorityIsAnsweredInOnePushnow covers both spellings. The new "mesh Service port differs from the app port" case reproduces production (app port 8080, dialed port 18081) and fails on the pre-fix tree with the deployment symptom:TestLoadClustersFromRegistry_MultiPortgains the mesh-port alias assertions, andTestLoadClustersFromRegistry_MeshPortServedAsRealPortpins the no-shadowing rule.Commit 2 — the ~20s echo outage after every agent restart
Before-state (talos-main, rev194, 2026-09-05)
Prober
http_error+130 (w01) / +127 (w03) inside those windows, then flat; the newAetherProberHTTPErrorBurstalert fired and resolved. On the 09-05 soak (rev192) the agent roll at 02:35:51Z produced zerohttp_errorat the next checkpoint.The agent is not slow
The xDS socket was accepting 1.8s after the anchor (13:34:48.125Z). PreListen did not stall — no
registry watch cache not complete in time, noregistry unavailable for initial snapshot. The catalog was healthy — norejecting on-demand request for unknown service. No TTL expiry fired — noexpired observed upstreams, andservice left dependency setappears only for an unrelated service outside the window.The access logs pin the outage exactly:
cluster_not_found/NCper node, echo only (uds-echoanduds-cr-echoserved 200 throughout the same window, so the proxy, its mTLS and its other clusters were fine);onDemandClusterTimeout = 2s, with releases batched every 2s, ~7 rounds.So Envoy's
on_demandfilter was engaging and timing out, while the agent'sonDeltaRequestcallback — which logs synchronously on any named delta-CDS subscribe — logged nothing for 14.05s (w01) / 14.67s (w03).Mechanism
The observed half of the dependency set is process-local memory, so a restarted agent's first snapshot legitimately drops every ODCDS-acquired upstream. That is meant to cost one round trip — except a reconnecting Envoy never re-asks:
markStreamFresh()puts every requested resource back into waiting for server and clears the pending-add set;initial_resource_versionsonly for resources it holds, andresource_names_subscribeonly for names added since;updateSubscriptionInterestdedupes every later re-subscribe for a name already inrequested_resource_state_.So nothing reaches the new agent at all until Envoy's 15s init-fetch timeout tears that subscription state down and the next request re-subscribes from scratch — hence 14–15s, hence the total silence on the agent side, and hence why this is invisible on a node where echo is a declared upstream (a pod annotation survives the restart; an observation does not).
The fix
initial_resource_versionsis the evidence the agent was ignoring: it is the proxy stating, in the protocol, exactly which clusters it is still running on.resumeHeldClustersre-seeds the node dependency set from it on the first request of every delta CDS stream — before the first snapshot push — so the upstream never leaves the snapshot at all.Restored entries are ordinary TTL'd observations, not live-subscription pins: an upstream the proxy has stopped using still ages out, so demand scoping still shrinks after a restart. They are also not counted as ODCDS misses — the proxy is not asking for something new, the agent is recovering demand it had already granted, and counting them would drown the miss metric (the signal to promote an upstream to an annotation) in one burst per restart. Only plain mesh service clusters are accepted,
<svc>.<ns>.<domain>with an optional:<port>suffix: per-podapp_/health_clusters, thetcp:floor clusters (a lenient match would mint keys likens/tcp:svc) and the passthrough cluster are not demand-set entries, and a held name whose service has left the catalog is skipped silently rather than counted as a rejection.Tests — all three fail with the resume pass stubbed out:
TestOnDemandObserver_ResumesHeldClustersOnAFreshStream— the reconnect handshake with no named subscribe at all, plus the name filtering and the no-pin rule;TestOnDemandObserver_ResumeIsIdempotentAndFirstRequestOnly;TestRestoreDependency_AnsweredInTheFirstPushAndStillDecays— fresh cache, empty dependency set, registry loaded: the requested authority is in the first push, and still decays.Commit 3 — observability for the TTL half
The in-use exemption's entire effect is that nothing happens, and its only trace was a Debug line, so the validator could not observe it working. Add
aether.agent.upstreams.ttl_refreshed, incremented per exempted entry per prune pass alongside the existingaether.agent.upstreams.*instruments and nil-receiver-safe like the rest ofcachemetrics(a no-op forn <= 0). The accompanying log moves to Info for the same reason — it fires at most once per prune tick and only when an entry actually crossed its TTL.Validation
make format,bazel test //...(96/96 pass), lint with--config=lint --@aspect_rules_lint//lint:fail_on_violationon the touched packages. No chart change.Not covered here: re-running the shrink test with the
:18081alias actually present (the path that was never exercised), and confirming the post-restart gap is gone on the next roll — both belong to the next deployment validation.Refs #682
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr