Repository navigation
feat(cni): reconcile local storage against the node's actual pods (#261) - #264
Merged
Merged
Conversation
…sue #261) The ghost sweep reconciled the registry against local storage but never reconciled local storage against the node's real pods, so two desync classes went uncured (talos worker-01, 2026-06-22): - Orphan ghost: a missed CNI DEL that left the netns bind-mount pin behind. netnsExists() stats the lingering pin and reports present, so the existing stale-prune never removed it; the agent kept emitting a listener bound to a dead netns (prober-vhbp8) — a connection sink and a latent #245 segfault. - Missing pod: a live, mesh-managed pod with no storage entry (a lost CNI ADD) that therefore had no listener and 100% connection_error (prober-k7vsm), and never self-healed. The agent's manager cache is already scoped to spec.nodeName=<this node>, so listing the node's pods is local and cheap (no new RBAC — it already has pods get/list/watch). The sweep now: - Prunes a stored pod when EITHER its netns is gone (existing) OR its Kubernetes pod no longer exists — by pod identity, regardless of a lingering pin. The pruned pod's registry endpoint then falls through to ghost deregistration as before. If the pod list fails we skip prune-by-absence (an empty list would nuke every entry) but still run the netns prune. - Surfaces live, Running, mesh-managed pods that storage has no entry for: the agent can't synthesize the CNI data to self-heal, so it emits a metric + warning (the pod must be rolled) instead of silently serving no listener. New metrics: ghost_sweep.orphans_pruned, ghost_sweep.missing_storage. Tests: TestSweepPrunesOrphanedPods (lingering-pin orphan pruned + ghost-deregistered, live pod kept) and TestIsMeshManagedK8sPod; existing sweep tests keep a nil k8sClient and skip the pod reconcile via a defensive guard. This is the cure layer; the guaranteed-delete reorder (#262) is the prevention and the startup taint (#263) closes the cold-start window. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S
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 cure layer for #261 — the storage↔pods reconcile that fixes the two desync classes the existing sweep couldn't.
Problem
The ghost sweep reconciled registry ↔ local storage but never local storage ↔ the node's real pods, so two classes went uncured (talos worker-01, 2026-06-22):
prober-vhbp8): a missed CNI DEL left the netns bind-mount pin behind.netnsExists()stats the lingering pin and reports present, so the existing stale-prune never caught it — the agent kept emitting a listener bound to a dead netns (a connection sink + latent fix(agent,proxy): prune stale-netns pods + supervisor crash-fast-fail #245 segfault).prober-k7vsm): a live, mesh-managed pod with no storage entry (lost CNI ADD) → no listener → 100%connection_error, never self-healing.Fix
The manager cache is already scoped to
spec.nodeName=<this node>, so listing the node's pods is local + cheap — no new RBAC (agent already haspods get/list/watch). The sweep now:Running, mesh-managed pod with no storage entry gets a metric + warning (the agent can't synthesize the CNI data to self-heal — the pod must be rolled) instead of silently serving no listener.Metrics
aether.agent.ghost_sweep.orphans_pruned,aether.agent.ghost_sweep.missing_storage— both desyncs are now visible.Tests
TestSweepPrunesOrphanedPods: a lingering-pin orphan (netns present, K8s pod gone) is pruned + ghost-deregistered; the live pod is kept.TestIsMeshManagedK8sPod: the managed-pod predicate (namespace / label / IP).k8sClientand skip the pod reconcile via a defensive guard.Build green (
bazel build //..., agent suite passes). The prevention is #262 (guaranteed delete) and the cold-start layer is #263 (startup taint) — the three layers of #261.