Repository navigation
fix(registrar,controller,edge): NotReady until identity, not after a dwell (#740) - #744
Merged
Merged
Conversation
…dwell (#740) PR 4 of #740. The readiness dwell PR 2 gave the registrar, controller and edge is the agent's dwell, and it is wrong for a Deployment. Observed on the rev210 upgrade roll (2026-09-07 20:03:45Z): a registrar Pod was in its Service's endpoints before it had an SVID, so an agent on main-worker-01 dialled a replica that could not handshake and logged two ERRORs for it — `failed to start watch stream, retrying` (registrar.go:574) and `failed to refresh clusters from registry` (server/refresh.go:193), both carrying `transport: authentication handshake failed: x509svid: could not get X509 bundle`. The agent's dwell is not about the agent tolerating a slow SPIRE. It exists solely because NotReady on the agent DaemonSet is the signal the controller's node-taint guard consumes, and a taint is a fleet-level action a 40s hiccup must not trigger. Nothing behind a Service has that coupling: there NotReady removes one replica from one endpoint set, which is precisely the correct handling of a pod that cannot complete an mTLS handshake. So `spire.ReadyChecker` now takes the dwell as a parameter instead of reusing the wait's WARN threshold — the two questions were only ever the same value on the agent. The agent keeps `NotReadyDwell` (2m); the registrar, controller and edge register `spire-svid` with the new `ServiceNotReadyDwell` (0). The edge included: it serves ingress behind the MetalLB LoadBalancer, where a second replica goes on serving while this one waits. The WARN/INFO escalation on the wait itself is unchanged, and `--spire-wait-warn-after` is now a logging threshold only. The agent side of that handshake failure is reclassified too. When our OWN identity is ready but the peer rejects the handshake for want of its own, `common/spire.IsPeerIdentityUnavailable` recognises it and both paths treat it like #718's drain GOAWAY — the server's startup, not a client fault: - the watch loop logs INFO `registrar has no identity yet; retrying`, counts no `watch_errors`, and retries on a bounded (doubling, capped at maxBackoff) backoff. It escalates where the own-identity deferral does not, because nothing wakes this loop when the FAR side acquires its SVID. - the cluster refresh logs WARN `cluster refresh deferred: the registrar has no identity yet, keeping the current snapshot` and counts no `refresh_errors`. Every other reload failure keeps ERROR and the counter: those leave the cluster snapshot stale until the next change signal, which is the condition the counter exists to surface. Tests: the readiness table gains the dwell dimension plus a pin that the two dwells differ deliberately; the three call-site tables assert NotReady with no SVID (the edge additionally that a long warn-after does not keep it Ready); a fake registrar whose mTLS handshake fails with the observed error asserts the INFO line, the absent counter and the bounded backoff; and the refresh path is tested for level and counter on both the identity transient and a real failure. Runbook: a per-component readiness table in "stuck waiting for SPIRE", and the Deployment bullets now say NotReady for the whole wait. Chart: values.yaml comment corrected, PATCH bump to 0.92.12. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
PR 4 of #740. PRs 1-3 (#741, #742, #743) made every binary survive a SPIRE that
is still coming up. This one fixes what PR 2 got wrong about the Deployments.
The observation
On the rev210 upgrade roll, 2026-09-07 20:03:45Z, a registrar Pod was in its
Service's endpoints before it had an SVID — PR 2 gave the registrar and the
controller the agent's 2 m
spire-sviddwell, so the replica reported Ready forthe first two minutes of its wait. An agent on
main-worker-01dialled it andcould not handshake:
which surfaced as two ERROR lines, for one transient that healed on its own:
Why the dwell is agent-only
The agent's dwell is not a general tolerance for a slow SPIRE. It exists for
exactly one reason: NotReady on the agent DaemonSet is the signal the
controller's node-taint guard consumes (proposal 033), so a gate that failed from
t=0 would turn a 40 s SPIRE hiccup into a fleet-wide
aether.io/agent-not-readytaint. That is a fleet-level action, and the dwell is the guard against it.
The registrar, controller and edge are Deployments behind Services. NotReady
there means one thing — take this replica out of the endpoint set — and that is
precisely the correct handling of a pod that cannot complete an mTLS handshake.
A replica that cannot handshake has no business being dialled.
aether-agentNotReadyDwell)aether.io/agent-not-ready:NoScheduleaether-registrarServiceNotReadyDwell)aether-controlleraether-edgeThe edge is included deliberately: it serves ingress behind the MetalLB LB
Service, and a second replica goes on serving while this one waits.
spire.ReadyCheckernow takes the dwell as a parameter rather than reusingthe wait's WARN threshold. The two questions — "how long before this wait is
worth waking someone for" and "how long before NotReady is the right answer" —
only ever shared a value on the agent.
--spire-wait-warn-afteris now a loggingthreshold only; the WARN/INFO escalation on the wait itself is unchanged, as is
the once-per-transition readiness logging on the agent.
The classification change
The other half of the observation is the agent's own reaction. When our identity
is ready but the peer rejects the handshake for want of its own, that is the
server's startup — not a client fault, and not the "registrar will not serve this
stream" condition #700 made those ERRORs for. New
common/spire.IsPeerIdentityUnavailablerecognises it (could not get X509 bundle/x509svid:, matched on the whole error so a gRPC status carrying thehandshake failure matches too), and both paths treat it the way #718 treats a
drain GOAWAY:
registrar has no identity yet; retrying(
peer_identity_pending=true), nowatch_errors, bounded backoff. Itdoes escalate the backoff, unlike the own-identity deferral from fix(agent): wait for the SPIRE Workload API instead of dying on it (#740) #741:
nothing wakes this loop when the far side acquires its SVID, so it has to keep
polling, and the doubling — capped at
maxBackoff— is what stops a genuinelydead registrar from being polled every second forever.
cluster refresh deferred: the registrar has no identity yet, keeping the current snapshot, norefresh_errors. Everyother reload failure keeps ERROR and the counter: those leave the cluster
snapshot stale until the next change signal (reloads are not retried), which is
the condition
refresh_errorsexists to surface, and burying it under a boot'sworth of handshake noise is what this avoids.
The peer check runs after the existing local
identityPending()check, so aclient with no certificate of its own never blames the server.
Tests
common/spire: the readiness table gains the dwell dimension (nil source,SVID-in-hand, waiting — each on both dwells), plus
TestServiceNotReadyDwellIsZeropinning that the two dwells differ deliberately.
TestIsPeerIdentityUnavailablecovers the literal rev210 gRPC status, the bare go-spiffe error, and the
negative controls: our own
ErrNoSVIDYet, a connection-refused dial, a drainGOAWAY.
NotReady with no SVID; the edge additionally asserts that an hour-long
--spire-wait-warn-afterdoes not keep it Ready (the flag no longer drives thegate).
registry/internal/registrar:TestWatchLoop_DefersWhilePeerHasNoIdentityruns the client against a fake registrar whose mTLS handshake fails with the
observed error while the client's own identity is ready — asserting the INFO
level,
peer_identity_pending=true, no ERROR of any kind, and nowatch_errorssample.TestDeferPeerStreamBoundsTheBackoffpins the doublingand the cap.
agent/internal/xds/server:reportReloadFailureis tested for level andcounter on the identity transient (WARN, no counter), on a real failure (ERROR,
counter = 1), and with instrumentation disabled.
Chart
No template change.
values.yaml'sspire.waitWarnAftercomment claimed thedwell applied "on all four components", which is now false — corrected, with a
PATCH bump to 0.92.12 (comment-only chart changes are CI-enforced to bump).
Runbook
docs/runbook.mdgains a per-component readiness table in "stuck waiting forSPIRE", states that the agent's dwell is a taint-guard artefact rather than a
general tolerance, and the three Deployment bullets now say NotReady for the
whole wait. The registrar bullet documents both new log lines.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr