Skip to content

feat: Enable Registrar HA with independent replicas - #45

Merged
bpalermo merged 1 commit into
mainfrom
feat/registrar-ha
Mar 22, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/registrar-ha

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

  • Add NeedLeaderElection() bool returning false to xds.Server and Syncer so all replicas run their gRPC server and sync loop independently of controller-runtime leader election
  • Update the registrar proposal to reflect the simplified HA design: no leader election, no write forwarding, no inter-replica coordination — every replica is identical

Design rationale

Leader election and write forwarding are unnecessary because:

  • Broadcast ordering is guaranteed per gRPC stream, not per cluster
  • Pod lifecycle writes are node-local and serialized by the caller
  • Agents use eventual consistency — no read-after-write guarantees needed
  • N=2-3 replicas polling every 5s is negligible load on any backend

Test plan

  • bazel test --config=llm //registrar/... — all tests pass
  • bazel test --config=llm //agent/... — all tests pass (xds.Server changed)
  • bazel build --config=llm //registrar/cmd/registrar/... — binary builds
  • bazel build --config=llm //agent/cmd/agent/... — binary builds

🤖 Generated with Claude Code

Add NeedLeaderElection() to xds.Server and Syncer so all replicas run
their gRPC server and sync loop regardless of controller-runtime leader
election. Update the registrar proposal to reflect the simplified HA
design: no leader election, no write forwarding, every replica is
identical and fully independent.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@bpalermo
bpalermo merged commit de6d6c7 into main Mar 22, 2026
7 checks passed
@bpalermo
bpalermo deleted the feat/registrar-ha branch March 22, 2026 21:30
bpalermo added a commit that referenced this pull request Sep 7, 2026
…ady (#740) (#743)

The three findings from #741's on-cluster validation (talos-main rev209,
2026-09-07). None is a defect in what #741 set out to fix — the agent no longer
dies on a cold SPIRE, 0 restarts across a 6m41s blackout — but the first is a
regression against the crash loop it replaced.

F1. A restarted agent with no SVID cannot handshake to the registrar, so
PreListen's bounded registry-ready wait expires, the local-only fallback fires,
and the agent PUSHES that snapshot — replacing a complete one and evicting every
cross-node endpoint. On main-worker-03 (no local echo replica) ~95% of the
node's mesh_dns probes failed for the whole outage, +5,083 errors, while the
other four nodes were at exactly 0. The crash loop never did this, because a
dying agent publishes nothing and Envoy keeps its last config. PreListen now
holds while identity is pending — INFO `holding xDS until this agent has an
SVID; Envoy keeps its current configuration` every 15s with a rising elapsed —
and the registry wait plus its local-only fallback apply unchanged from the
moment identity exists. Mid-life is already correct and is untouched: once a
snapshot is published the cache keeps it.

F2. The controller's node-taint guard re-armed `aether.io/agent-not-ready` 30s
after the agent went NotReady, and the agent's own remover — gated on the CNI
socket and conflist chaining only (#667) — dropped it ~50ms later, eight times
in a row. The node was tainted for ~50ms per 30s, i.e. never. The remover now
consults the SAME readiness aggregate the kubelet polls, so both controllers
read one verdict; the socket+chained conditions keep their #667 semantics. This
is safe now that spire-server, spire-agent and the SPIFFE CSI driver tolerate
the taint (k8s-talos-main #45), which is why SPIRE was kept out of the gate
before.

F3. Recovery was announced 2m11s early: readyz `spire-svid` passed 3s after the
SVID landed while every mTLS client kept failing `could not get X509 bundle`.
Two causes, both fixed — readiness now means SVID AND the bundle for its trust
domain (the WaitingSource publishes its source only when both are servable), and
the registrar client is woken on identity, resetting the gRPC ClientConn's own
backoff (at its ~120s cap by then, answering from the cached handshake failure
rather than dialling) and cutting the retry sleep short.

Also: /readyz?verbose prints `spire-svid failed: reason withheld` because
controller-runtime redacts checker errors, so each check now logs its reason
once per transition — WARN `spire-svid readiness failing` / INFO `… passing`.
Runbook and the values.yaml toleration note updated; the tolerations are now
REQUIRED, not advisory.

`--spire-enabled=false` (#421) is byte-identical: no gate, no check, no hold.


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant