Skip to content

cni: persist cni-install's rendered entry so the re-assert loop can prime from disk #680

Closed

Description

@bpalermo

Follow-up from #667. Not a regression from that PR — a pre-existing gap it made visible and could not close.

The window

cni-install renders aether's plugin entry and appends it to the node's active conflist once per agent pod start, and keeps that rendered entry in memory only (cni/internal/install/cniconfig.go). The re-assert loop never re-renders it: it primes Reasserter.entry from whatever it observes in the file on its first successful check, deliberately, because the netconf carries installer-time parameters (OTLP endpoint, redirect-all default, mesh-DNS DNAT target) the agent has no business re-deriving.

That leaves a small but real hole. If a competing writer strips the entry between cni-install's write and the reasserter's first check(), the loop observes an already-stripped conflist, has nothing primed, and logs:

aether is not chained in the active CNI conflist and no known-good entry was ever observed; cni-install must run

r.entry then stays empty for the whole life of that agent process. Every subsequent re-check finds the entry missing and refuses to repair. The node is unrepairable until the agent pod is recreated (a process restart is not enough — the entry comes from the init container).

The window is short, but it is precisely the window a Talos bootstrap-manifest re-sync opens: flannel pods and aether-agent pods are recreated in the same event, and cp -f can land after cni-install and before the first check.

Why #667 doesn't close it

#667 makes this state visible and safe rather than silent:

  • the taint gate refuses to remove the startup taint while unchained, so the node stops taking new pods;
  • the agent reports NotReady, so the controller's guard re-arms the taint on a running node;
  • the ghost sweep stops evicting into it;
  • AetherCNIConflistUnchained pages.

All correct, and all of it still ends in "delete the agent pod on that node". Nothing repairs it.

Proposal

Make the known-good entry durable so the reasserter can prime from disk rather than only from a healthy observation:

  1. cni-install writes its rendered entry to a stable path alongside the conflist, e.g. /etc/cni/net.d/.aether-cni-entry.json. The leading dot and the .json extension both matter: conflist.ConfigFilenames only considers .conf/.conflist, so this file can never be mistaken for a network config by us or by kubelet.
  2. Reasserter primes r.entry from that file when its first check finds the conflist already stripped, falling back to the current observe-from-file behaviour.

Result: the repair path survives the priming window, and survives an agent process restart onto an already-stripped node without needing pod recreation.

Open questions for whoever picks this up

  • Staleness. The file is re-written at every agent pod start, so it is as fresh as the init container's render. Worth deciding whether the reasserter should ever prefer it over an observed entry (probably not — an observed entry is proof of what the node actually accepted).
  • Whether the file should be written atomically via common/file.AtomicWrite (yes) and what mode (0600 is enough; nothing else reads it).
  • Interaction with the --cni-conflist-reassert=false kill switch: cni-install should probably write the file regardless, since it costs nothing and the flag is about the loop, not the artifact.

Scope

Small and self-contained: one write in cni-install, one fallback in Reasserter.check/repair, plus tests. No API, no chart values, no new flags (proposal 031).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions