Repository navigation
fix(agent): an agent restart stops waiting out retry ladders before it serves its node proxy (#1123) - #1135
Merged
Conversation
…t serves its node proxy (#1123) The node proxy has no ADS stream from the old agent's exit until the new one serves xDS. Measured on kind (e2e/agent-restart-gap.sh, proxy-side control_plane.connected_state, 2 nodes, etcd backend): median 12.0 s / p99 17.9 s on main (n=16), median 5.5 s / p99 8.8 s on this branch (n=20). Startup, after the agent's own SVID, drops from ~6 s to ~0.1 s: - The registrar client's post-identity reconnect waits for the ClientConn to be READY instead of sleeping a whole 1 s backoff after the wake's first retry lost the redial race (the steady ~1.05 s on every talos node). - The SPIRE bridge's pod subscriptions retry the moment the agent's own SVID is served (with the broker connection's backoff reset) instead of on their 1 s+ doubling ladder; on main the client-certificate first-serve gate of #1118 hit its 5 s bound in 7 of 16 kind restarts. - Every Workload API source retries 200 ms / 400 ms / then every 500 ms instead of go-spiffe's linear whole-second ladder. - PreListen builds the local listeners from storage during the identity hold (the socket still opens only after identity, capture projection, registry load and client certificates); the #877 TCP-floor WARN gets a 1 min startup grace with SPIRE on so this does not log on every restart. Pod replacement: - agent and cni-install images default to IfNotPresent (digest-pinned; the kubelet counted 1.44 s of image checks on one talos restart). - cni-install leaves an identical plugin binary, conflist and durable entry alone instead of rewriting and fsyncing them on every pod start. - Readiness probed every 2 s from the start (Ready ~1 s after container start instead of ~10 s), failureThreshold 15 keeps 30 s to NotReady. The remaining terms (pod replacement 2.8-3.4 s on kind, the SPIRE first SVID 1-5 s on kind / 0.15-2 s on talos) are not the agent's to remove; proposal 041 designs the surge roll with a standby agent that removes both. Chart 2.2.0 -> 2.2.1. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…go's subchannel map; redial on a 250 ms cap instead (#1123) grpc-go's ClientConn.ResetConnectBackoff copies the map reference under cc.mu and iterates it after unlocking, so it races newAddrConnLocked writing the same map (the race job on #1135: TestBridgeSurvivesSubscribeFailures, 12 of 20 local runs). The broker connection is node-local; it now redials on a 50 ms base / 250 ms cap backoff, which bounds how long WaitReady takes after the agent's SVID lands without touching the ClientConn's internals. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
… fix/1123-agent-restart-gap
bpalermo
added a commit
that referenced
this pull request
Oct 2, 2026
…with #1135) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
added a commit
that referenced
this pull request
Oct 2, 2026
…962a5716eee28319cf (#1138) * chore(proxy): pin aether chart to aether-proxy:05b687b77741b8271a7c35962a5716eee28319cf Pushed by the proxy-release run for 05b687b. Moves both tag: and digest: (aether.image prefers digest over tag) and bumps the chart patch version. * chore(chart): bump to 2.2.3 for the proxy image pin (main took 2.2.2 with #1135) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Oct 3, 2026
…hashResource in xds/cache) (#1162) - agent/internal/spire.sleepCtx lost its last caller in #1135 (the bridge's retry ladder moved to a context-bounded wait). - agent/internal/xds/cache.hashResource was added in #1114 alongside versionMemo.hash and was never called; every caller uses the memo. Proof: golang.org/x/tools/cmd/deadcode run through rules_go's gopackagesdriver over every first-party main package reports both as unreachable, and `grep -rnw` finds no reference outside the definition in any .go file (production or test), chart, doc, e2e script or workflow. 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.
Refs #1123
The target is not met yet, so this is
Refs, notCloses. Across an agent roll the proxy-side gap is now median 5.5 s / p99 8.8 s on kind; the target is p99 < 5 s. Everything the agent itself waits on after its own SVID now takes about 0.1 s. What is left is pod replacement and SPIRE's first SVID, and neither is the agent's to remove: delete-then-create cannot start a sandbox, an init container and the agent in under a few seconds. Proposal 041 (in this PR) designs the surge roll that removes both. What remains is at the end.Measured: where the gap goes
talos-main, before (read-only)
Source: VictoriaLogs agent lines and the kubelet log on main-worker-04. 10 restarts across the 2026-10-02 rolls at 03:05Z and 06:53Z. The proxy had no ADS stream for 7.6–15.8 s.
Wait completed. Shutdown is already prompt; no change neededAlwaysimage checks (1.44 s per the kubelet's owntotalImagesPullingTime), cni-install (0.2–0.4 s), container startkind, before and after (
e2e/agent-restart-gap.sh, new)Setup: control plane + worker, SPIRE, etcd registry backend. A poller on each node reads
control_plane.connected_statefrom the proxy admin every 50 ms. Each roll isrollout restart ds/aether-agent, and every node of every roll is one sample. Both arms ran the branch chart; only the agent and cni-install images differ.Changes, each with its number
registry/internal/registrar).deferReconnectnow waits for the ClientConn to report READY, bounded by its backoff, instead of a fixed sleep.watch stream connecteddrops to the dial time.agent/internal/spire).identityArrived. The broker connection redials on a 50 ms / 250 ms-cap backoff (brokerConnectParams) instead of gRPC's 1 s / 120 s default. It does not callClientConn.ResetConnectBackoff: grpc-go 1.83.2 iterates the subchannel map there after droppingcc.mu, which races subchannel creation (theracejob failure on this PR, 12 of 20 local runs; 0 of 20 after).common/spire/tls.go, which every binary uses).agent/internal/xds/server).IfNotPresentfor the agent and cni-install images (chart).Alwaysonly added registry round trips: 1.44 s on a talos restart.Never, so this term shows only in the talos number.periodSeconds: 2, with no initial delay.failureThreshold: 15keeps 30 s to NotReady, which proposal 033's guard is tuned against.Not changed:
Surge verdict
Two agents cannot safely overlap on a node in this PR's scope. The concrete blockers:
containerPort8080 and 8082 default to hostPorts, so the scheduler's NodePorts filter keeps a surge pod Pending, and the process could not bind those ports anyway. Probes would have to move to a pod-local socket with an exec probe binary.envoyAckTimeout2 s), and the pod then starts without a listener. One that doesn't answer them misses what the old agent did, unless it reconciles from storage on takeover.LoadListenersFromStoragenever removes anything.UnixListener.Closeunlinks its path by name, so the old agent's exit would delete a new socket.docs/proposals/041_agent-surge-handoff.mddesigns a standby agent:flockrelease: diff-reconcile, bind, start the writers it held back.The proposal covers every hazard above and the open questions. Not implemented, and no chart value.
Evidence (unit tests, each seen red, then green)
registry/internal/registrarTestWatchLoop_ReconnectWaitEndsWhenTheConnectionIsReadyagent/internal/spireTestPodSubscriptionsRetryAsSoonAsTheAgentHasAnIdentitycommon/spireTestNewSourceWithTimeout_FollowsTheFirstSVIDCloselyTestFirstSVIDBackoffagent/internal/xds/serverTestPreListen_LoadsLocalListenersWhileIdentityIsPendingCondition never satisfied; also asserts no registry call and no return before identityagent/internal/xds/cacheTestTCPFloorWarningSparesTheStartupIdentityWaitcni/internal/installTestCopyBinaries_LeavesAnIdenticalInstallAlonecni/internal/installTestWriteCNIConfigLeavesAnUnchangedChainAlonecni/internal/installTestCopyBinaries_ReplacesAnyDifference//charts/aether:aether_agent_restart_fast_path_testIfNotPresent×2 and the probeChecks:
bazel test --test_tag_filters=-integrationover//agent/... //common/... //registry/... //cni/... //charts/... //registrar/... //controller/... //test/envoy_validate:all: 145/145 pass.--config=racepasses on registrar, spire bridge, common/spire, xds/server, xds/cache and install.make gazelleandmake formatwere run.bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...is clean.subscribing … failed; retryingwent from 127 on main to 110 here, across more restarts.The harness:
What remains on #1123
Expected on talos with this PR: roughly 4–9 s, against 7.6–15.8 s before. That is not measured yet. The next soak's agent rolls are the check: agent
registry connected … waited,client certificates … waited, and the proxy reconnect.Risks
IfNotPresent: a user who overridesdigest: ""with a mutable tag no longer re-pulls. The values comment says to setAlwaysfor that case.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr