Repository navigation
fix(agent): emit one consistent xDS snapshot to stop resource clobbering - #75
Merged
Merged
Conversation
The cache had separate generators that each set a partial snapshot for one resource type: listeners, clusters/endpoints/routes, secrets, and vhosts. Because go-control-plane's SetSnapshot replaces the entire node snapshot, each update dropped every other resource type from Envoy. With a managed pod present, the agent churned listeners on/off as cluster and secret updates fought them (observed live: lds add/remove cycling, "no outbound listener" -> connection refused), and SDS secrets never went active. Funnel all mutations through a single generateSnapshot that assembles a complete, consistent snapshot (listeners + clusters + endpoints + outbound route config + secrets) from the in-memory maps — nothing is rebuilt, so it stays cheap. The per-type generators now delegate to it. Drop the unused generateVhostsSnapshot (VirtualHostType/VHDS was never wired; the outbound listener uses RDS). Adds a regression test asserting the node snapshot holds listeners, clusters, routes and secrets simultaneously after a trailing secret update. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This was referenced Jul 19, 2026
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.
Problem
The cache had four separate snapshot generators, each setting a partial snapshot for one resource type (listeners; clusters/endpoints/routes; secrets; vhosts). go-control-plane's
SetSnapshotreplaces the entire node snapshot, so each update dropped every other resource type from Envoy.Observed live on talos-main with a managed pod present: the proxy log shows LDS
add/update listenerimmediately followed byremove listenerin a cycle (cluster + secret updates fighting the listener update), so the outbound listener was usually absent →curl: (7) connection refused. SDS secrets likewise never reachedactive.This was masked before because clusters were loaded once at startup (with 0 services) and SVID subscription never succeeded — once #71 (dynamic cluster refresh) and #72/#74 (working SVID subscription) started pushing cluster/secret snapshots, the clobber became continuous.
Fix
Funnel every mutation through a single
generateSnapshotthat assembles a complete, consistent snapshot — listeners + clusters + endpoints + outbound route config + secrets — from the in-memory maps. Nothing is rebuilt, so a full snapshot stays cheap. The per-type generators now delegate to it. Removed the deadgenerateVhostsSnapshot(VHDS was never wired; the outbound listener uses RDS).Adds a regression test asserting the node snapshot holds listeners, clusters, routes and secrets simultaneously after a trailing secret update.
Note
Depends on #73 (SnapshotCache nil-map init) to start with pods in storage.