Repository navigation
feat(mesh-dns): decouple resolver into a surge-capable daemon (#578) - #579
Merged
Merged
Conversation
The mesh-DNS resolver was in-process in the node agent, so every agent roll opened a per-node window with no listener on the :53 DNAT target (HOST_IP:18054) — #577's warm-start/bind-early could only make the NEW resolver fast once it bound, not cover the container-recreation gap. Decouple the resolver into a standalone aether-mesh-dns DaemonSet. It owns :18054 alone (only a UDP/TCP socket, no host-path UDS to collide), so maxSurge:1 + SO_REUSEPORT lets the successor co-bind while the predecessor still serves — a truly hitless handoff across its own rolls, which an agent roll could never do. Records flow agent -> snapshot file -> daemon (fsnotify), reusing #577's snapshot as the feed. The CNI DNAT target is unchanged. - meshdns: extract Read/WriteSnapshot package funcs (shared by the agent persist path and the Server load); add ReloadFromSnapshot for the daemon's fsnotify handler; add WithReusePort so Start binds UDP+TCP with SO_REUSEPORT+SO_REUSEADDR (net.ListenConfig.Control) and serves via ActivateAndServe. Resolver semantics (EDNS0 echo, NODATA, never forward mesh, authoritative) unchanged. - agent mesh-dns subcommand: binds HOST_IP:18054, loads the snapshot, watches its PARENT dir (survives the atomic rename, like agent/storage) and reloads on debounced create/write/rename of the snapshot file; push-only OTel metrics like the proxy-supervisor. No k8s API access. - agent: wireMeshDNS is persist-only now — the capture sink writes the snapshot via meshdns.WriteSnapshot; the agent no longer binds :18054. - chart: new aether-mesh-dns DaemonSet (host-net, maxSurge:1/ maxUnavailable:0, registry hostPath read-only, reuses the agent SA, no RBAC), gated by the same agent.meshDns toggle; agent container drops the now-unused HOST_IP env + --mesh-dns-upstream flag. Chart 0.83.0. Closes #578 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
bpalermo
added a commit
that referenced
this pull request
Jul 22, 2026
#579) (#580) The decoupled aether-mesh-dns DaemonSet has no readiness probe, so with maxSurge:1/maxUnavailable:0 k8s marks the new pod Ready the instant its container is Running — before it binds :18054 — and retires the old pod before the SO_REUSEPORT co-bind ever engages (+130 failed mesh_dns probes in talos e2e). Mirror the proxy-supervisor pattern: a pod-local ready-marker file the resolver writes only after its UDP+TCP listeners are bound, plus an exec readiness probe (agent mesh-dns --readiness-check) that stats it. The marker must be pod-local (per-pod emptyDir) — a network probe to hostIP:18054 could be answered by the OTHER co-bound REUSEPORT socket and falsely mark the new pod ready. This holds the predecessor until the successor truly serves, so the sockets overlap and REUSEPORT gives a zero-gap handoff. - meshdns.Server: WithReadyMarker option; Start writes the marker after buildServers binds and removes it on ctx shutdown (best-effort, never fatal). - agent mesh-dns: --ready-marker + --readiness-check flags (exec probe mode). - chart: writable /run/aether emptyDir, --ready-marker arg, exec readinessProbe (periodSeconds 2, failureThreshold 2); Chart.yaml 0.83.0 -> 0.84.0. Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Jul 22, 2026
…581) The mesh-dns readiness probe re-execs the full /agent binary (distroless image, no shell), whose cold start under the daemon's 50m CPU request/100m limit exceeds the 1s default probe timeout — so the surge pod never reported Ready and maxUnavailable:0 wedged the rollout (found on talos e2e: probe "command timed out after 1s" x136, pod stuck 0/1 though bound + serving). Bump the probe to timeout 5s / period 5s / failureThreshold 3, and give the daemon CPU burst (limit 100m→300m) + memory (64Mi→128Mi) headroom for the transient second /agent process the exec spawns. Marker semantics unchanged. Follows #578/#579/#580. Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Jul 25, 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.
What
Decouples the node agent's in-process mesh-DNS resolver into its own standalone, surge-capable
aether-mesh-dnsDaemonSet, so agent rolls no longer gap mesh DNS. Builds directly on #577 (warm-start snapshot at/host/var/lib/aether/registry/mesh-dns/records.json).Why
The agent DaemonSet is
maxSurge:0, maxUnavailable:1with no preStop, so every agent roll deletes the old agent (and its in-process resolver) before the new pod exists — a per-node no-listener window on the:53DNAT target. #577's warm-start/bind-early only make the new resolver correct once it binds; they cannot cover the container-recreation gap.The obvious zero-gap fix (
maxSurge:1+SO_REUSEPORT) is blocked on the full agent because it also binds host-path CNI/xDS UDS sockets that collide under surge. A standalone resolver has only the:18054UDP/TCP socket — no UDS collision — soSO_REUSEPORT+maxSurge:1becomes feasible and delivers a truly hitless handoff.Changes
meshdns: extractedReadSnapshot/WriteSnapshotpackage funcs (shared by the agent persist path andServer's load); addedReloadFromSnapshot()for the daemon's fsnotify handler; addedWithReusePortoption —Startthen binds UDP+TCP withSO_REUSEPORT+SO_REUSEADDRvianet.ListenConfig.Controland serves viaActivateAndServe. Resolver semantics (EDNS0 echo, NODATA-for-non-A, never-forward-mesh, authoritative) are byte-for-byte unchanged.agent mesh-dnssubcommand (agent/internal/cmd/meshdns.go, mirrorsproxy-supervisor): bindsHOST_IP:18054, loads the snapshot, watches its parent dir so the agent's atomic-rename write is caught (fsnotify loses the watch on the replaced inode — same asagent/storage), reloads on debounced create/write/rename of the snapshot file. Push-only OTel metrics like the supervisor. No k8s API access.wireMeshDNSno longer serves DNS; the capture sink writes the snapshot viameshdns.WriteSnapshot. Still gated by--mesh-dns.aether-mesh-dnsDaemonSet (host-network,maxSurge:1/maxUnavailable:0, registry hostPath mounted read-only, reuses the agent ServiceAccount, no RBAC, drops all caps — binds 18054 > 1024 so noNET_BIND_SERVICE). Gated by the sameagent.meshDnstoggle (default-on ⇒ daemon default-on). Agent container drops the now-unusedHOST_IPenv +--mesh-dns-upstreamflag; the CNI DNAT (init container) is unchanged. Chart bumped 0.82.0 → 0.83.0.Tests
Servers bind the same127.0.0.1:<port>, both answer), snapshot Read/Write round-trip,ReloadFromSnapshotpicks up a rewritten file. Existingserver_test.go+ capture reconciler + cmd tests stay green.bazel test //...(excl. integration): 72/72 pass.make format-checkclean. gocognit gate green (--config=ci). Chart lint + template tests pass.Acceptance (talos, follow-up)
Roll
aether-agent→mesh_dnsprober tier should stay ~0 errors through the roll (vs ~329 today). Rollaether-mesh-dns→ also hitless (surge + REUSEPORT overlap; two pods co-bind:18054). Confirm the daemon reloads on snapshot change.Closes #578
🤖 Generated with Claude Code
https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR