Repository navigation
feat(registrar,agent): write-behind external-registry writes - #145
Merged
Merged
Conversation
Closes the Cloud Map registration race that the rev-68 e2e exposed (and that the default panic threshold had been silently masking): a failed external-registry write left a serving pod invisible to the mesh for up to the 60s reconciliation sweep, driving the recorded healthy fraction of a rolling service to zero while real capacity existed. Per the design decision (2026-06-11): discovery moves at watch latency; the external registry — and therefore cross-cluster visibility — is eventually consistent. panic_threshold stays 0 (#144 closed unmerged); this is the fix that has to carry it. Registrar: - RegisterEndpoint/UnregisterEndpoint are now snapshot-first: apply + broadcast immediately, never fail the RPC on external-registry errors. The external write goes to a per-replica write-behind queue (1s..30s backoff, 5m max age with loud drop). - Pending-shielding: the sync loop overlays still-pending intents onto the fetched external state BEFORE Diff/Replace, so neither the broadcast events nor the wholesale snapshot replacement can regress an intent the external registry has not materialized yet (the rev-66 partial-view bug, approached from the write side). An op is released only after its write succeeded AND a sync observes the intent. - Metrics: writebehind.queue_depth / flush_failures / drops / shielded_intents. Agent: - The registry watch client signals each successful (re)connection (registry.ReconnectNotifier); the CNI server runs an immediate ghost sweep on it, re-asserting this node's registrations. A failed-over or restarted registrar replica that lost queued intents is repaired at reconnect speed instead of the sweep interval. Chart: - registrar replicaCount default 1 -> 2 (directive: always exercise the multi-replica topology). With 2 replicas, both serve gRPC and sync independently; an RPC-driven change is visible instantly on the receiving replica and converges on the peer via the external registry — peer-watch (origin-tagged replica-to-replica subscriptions over the existing WatchEndpoints protocol) is the planned phase 2 that closes that skew. Validation criterion on talos: svc-1 rolling restart under load with panic still 0 -> ~0 fails (rev-68 baseline: 352/439). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This was referenced Jun 11, 2026
bpalermo
added a commit
that referenced
this pull request
Jun 11, 2026
… not the watch cache (#149) The reconnect re-assert (#145) reused the ghost sweep, which listed endpoints via the registrar client's ListAllEndpoints — served from the watch-fed local cache. A fresh or failed-over registrar with an EMPTY snapshot emits no FULL_SNAPSHOT events, so that cache is never cleared: it remains a stale superset claiming every pod is registered, the diff concludes nothing is missing, and the re-assert silently no-ops — defeating exactly the state-loss repair it exists to provide. Observed in vivo (2026-06-11, backend-comparison e2e): switching the registrar's external backend left the new registry with zero services while every agent kept serving stale EDS; only restarting the agents (fresh cache = server truth) healed it. A registrar fleet replacement or backend data loss would hit the same latent gap. Fix: new registry.AuthoritativeLister capability — list from the authoritative source, bypassing any cache. The registrar client implements it via the existing ListAllEndpoints RPC; the ghost sweep prefers it when present. Cost: one RPC per sweep/reconnect per node, served from the registrar's in-memory snapshot. Regression test reproduces the stale-superset trap. Co-authored-by: Claude Opus 4.8 <[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.
The real fix for the Cloud Map registration race the rev-68 e2e exposed (and the default panic threshold had been silently masking since the beginning). Per the design decision: discovery moves at watch latency; the external registry — and therefore cross-cluster visibility — is eventually consistent.
panic_thresholdstays 0 (#144 closed unmerged); this PR is the fix that has to carry it.Registrar: snapshot-first writes + pending-shielding
RegisterEndpoint/UnregisterEndpointapply to the snapshot and broadcast immediately; the RPC never fails on external-registry errors. The Cloud Map write goes to a per-replica write-behind queue (1s→30s backoff, 5m max age with loud drop + metric).Overlay(fetchedState)beforeDiff/Replace, patching the fetched state with still-pending intents (registers injected, unregisters tombstoned). The wholesaleReplacewas the trap: filtering events alone wouldn't have stopped the snapshot itself from regressing. An op is released only when its write succeeded and a subsequent sync observes the intent (handles Cloud Map read-after-write lag).aether.registrar.writebehind.{queue_depth,flush_failures,drops,shielded_intents}.Agent: re-assertion on watch reconnect
The watch client signals each successful (re)connection (
registry.ReconnectNotifier); the CNI server runs an immediate ghost sweep on it. A failed-over/restarted replica that lost queued intents is repaired at reconnect speed instead of the 60s sweep — this is the durability story (deliberately no persistent queue).Multi-replica (2 replicas now the default, per directive)
Chart
replicaCount1→2 — both replicas serve gRPC and sync independently (verified: both the gRPC server and Syncer setNeedLeaderElection: false), so the split topology is permanently exercised. Interim semantics: an RPC-driven change is visible instantly on the receiving replica, converging on the peer via Cloud Map (write-flush + peer's sync interval). Phase 2 (separate PR): replicas peer-watch each other over the existingWatchEndpointsprotocol with origin tagging (apply + re-broadcast to agents; never forward to peers; never write the external registry for peer-sourced events), restoring watch-latency visibility cluster-wide.Testing
Validation criterion on talos (the one that matters): svc-1 rolling restart under load with panic still 0 → ~0 fails. Rev-68 baseline: 352/439.
🤖 Generated with Claude Code