Repository navigation
fix(mesh-dns): don't wedge when the snapshot dir doesn't exist yet - #592
Merged
Merged
Conversation
On a FRESH cluster the resolver daemon usually starts before the agent's first projection. The snapshot dir is created lazily by the agent, and the daemon mounts that volume read-only, so it found nothing to watch, logged "records will not reload until restart", and then served nothing FOREVER -- while reporting Ready 1/1, because the ready-marker is written after bind, not after records load. This is why the multi-cluster e2e has been red since 07-22 (#589) and why talos never showed it: there the dir has existed since #577, so the race cannot occur on an established cluster. Only a fresh install hits it, and kind is fresh every run. Two fixes, one per side of the race: - Agent: EnsureSnapshotDir at startup rather than on first write, so the dir exists before the daemon can look for it. Non-fatal. - Daemon: retry establishing the watch instead of giving up for the process lifetime, and poll ReloadFromSnapshot while blind so records land even if fsnotify never works. A missing dir is now WARN, not ERROR. The second is the one that matters: it fixes the class, surviving any startup ordering, agent restart, or volume remount. Refs #589. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
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.
Root cause of the multi-cluster e2e failing since 07-22 (#589), found via the diagnostics added in #590.
The bug
Every mesh-dns pod in both kind clusters logged:
The chain:
mesh-dns/subdir is created lazily by the agent, on its firstWriteSnapshot.readOnly: true— it cannot create the dir itself.This is a production bug, not a kind artifact. It's invisible on any established cluster (on talos the dir has existed since #577), and only bites a fresh install — which is what every kind e2e run is. No amount of soaking on an existing cluster could have caught it.
The fix — one per side of the race
EnsureSnapshotDirat startup instead of on first write, so the dir exists before the daemon looks. Non-fatal.ReloadFromSnapshotwhile blind so records land even if fsnotify never works. A missing dir is now WARN, not ERROR.The daemon half is the one that matters: it fixes the class, surviving any startup ordering, agent restart, or volume remount.
Verification
bazel test //agent/...27/27 ·--config=ci(gocognit) clean · format clean · slim dep graph re-proven (0 paths to controller-runtime and go-control-plane). New tests coverEnsureSnapshotDirand watcher recovery once the dir appears.e2e verification to follow on this branch.
Refs #589.
🤖 Generated with Claude Code