Skip to content

feat(cni): reconcile local storage against the node's actual pods (#261) - #264

Merged
bpalermo merged 1 commit into
mainfrom
feat/storage-pods-reconcile
Jun 22, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/storage-pods-reconcile

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

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):

  • Orphan ghost (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).
  • Missing pod (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 has pods get/list/watch). The sweep now:

  • Prunes by pod-existence: a stored pod is pruned when 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 ghost-deregisters as before. If the pod list fails, prune-by-absence is skipped (an empty list would nuke every entry); the netns prune still runs.
  • Surfaces missing ADDs: a live, 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).
  • Existing sweep tests keep a nil k8sClient and 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.

…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
@bpalermo
bpalermo merged commit 44bc8dd into main Jun 22, 2026
11 checks passed
@bpalermo
bpalermo deleted the feat/storage-pods-reconcile branch June 22, 2026 17:31
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