Repository navigation
cni: persist the rendered aether entry so the re-assert loop can prime after a boot-time strip - #689
Merged
Merged
Conversation
…r can prime after a boot-time strip (#680) cni-install renders aether's chained plugin entry once per agent POD start and kept it in memory only. The re-assert loop primes its known-good entry from what it OBSERVES on disk — deliberately, since the netconf carries installer-time parameters the agent has no business re-deriving — so a competing writer that strips the conflist between cni-install's write and the loop's first check left the loop with nothing to re-append for the life of the agent PROCESS. Init containers do not re-run on a container restart, so the node stayed unrepairable (taint held, agent NotReady since #667) until the pod itself was recreated. cni-install now also writes the entry it just chained, alone, to /etc/cni/net.d/.aether-cni-entry, and the loop primes from that file when — and only when — it has never observed a healthy one. An observed entry still wins: it is proof of what the node actually accepted. cni-install stays the file's single writer; the agent only reads it. The name matters: every CNI config loader selects files by filepath.Ext against an extension list — {.conf,.conflist} for kubelet and for us, {.conf,.conflist,.json} for containerd's go-cni, {.conf,.json} for libcni's deprecated LoadConf — and ".aether-cni-entry" matches none of them, so a lone aether plugin object can never be loaded as a network of its own. A ".json" suffix would NOT have been safe. No chart change: both the cni-install init container and the agent already mount the same host /etc/cni/net.d read-write. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…ntry # Conflicts: # docs/runbook.md
This was referenced Sep 5, 2026
bpalermo
added a commit
that referenced
this pull request
Sep 5, 2026
…#710) `cni/internal/install` logged half the install through `ctrl.Log` — controller-runtime's global logger — but nothing in `cni/` ever calls `ctrl.SetLogger`, so controller-runtime discarded every one of those records. On talos-main the `cni-install` init container therefore ended at `CNI binaries installed`: the pre-existing `Wrote CNI config` confirmation (the #645/#650 class signal that aether was chained into the node's conflist) and #689's `Wrote the durable aether CNI entry`, plus both of its `Error` paths, were silent in production. Take the issue's preferred fix: drop `ctrl.Log` and thread the installer's own logger down. The installer now holds a `*slog.Logger` instead of a logr bridge — the cni-install command already built the slog logger and only bridged it for controller-runtime's sake — and `cniconfig.go` and `cni/internal/util`'s file watcher take it as a parameter. controller-runtime is gone from all three packages; `cni/cmd/cni-install/main.go` keeps `ctrl.SetupSignalHandler`, which does not log. Messages and attribute keys are unchanged so operator greps still match. The two `Info` calls whose key/value list was malformed (a dangling value, and a bare filepath) get their `filepath`/`alternate` keys so slog does not render `!BADKEY`; logr's error argument becomes the repo-standard `"error", err` pair. Tests capture the installer's logger through a slog JSON handler and assert `Wrote CNI config` and `Wrote the durable aether CNI entry` are emitted at INFO with their filepath, and that both durable-entry failure paths (unwritable location, no aether entry to extract) log at ERROR — that ERROR line is the operator's only signal, since the durable write is deliberately swallowed. Verified end to end by running the built binary against a scratch conflist: six lines now, including the two that were missing. Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Fable 5.1 <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Sep 5, 2026
…d tag (#692) (#713) * fix(ci): serialise publishes and give the aether chart a commit-pinned tag (#692) Two `publish` runs for consecutive merges to `main` raced on the same chart version tag and the older build won: 0.92.1 was pushed by the newer commit (95b158e) at 13:15:59Z and overwritten by the older one (77a7d45) four seconds later, so the 13:16:27Z deploy silently shipped without #689. Two independent causes, both fixed: * `publish.yaml` had no `concurrency` group, so runs for `main` overlapped. Added `group: publish-main, cancel-in-progress: false` — a publish is not a redundant check to supersede; cancelling one mid-push would leave images pushed and the chart not. `proxy-release.yml` gets the same treatment for the same class of bug: its `bump-chart` job rewrites `charts/aether/values.yaml` on top of whatever `main` is at checkout and force-pushes the single rolling `chore/proxy-image-bump` branch, so overlapping runs drop one run's image pin. `main.yaml` (main-post-merge) deliberately gets none, and now says so: it writes no shared state, and serialising it would delay — or, via queued-run eviction, skip — the detection it exists to provide. * The `aether` chart was published only under its bare `Chart.yaml` version, a tag that does not change per commit. It is now also published as `charts/aether:<X.Y.Z>-<full git sha>`, the scheme crds/prober/udsecho already use, via a second packaging of the same chart whose `Chart.yaml` is *derived* from the first (a genrule appends `-{GIT_COMMIT}`), so the two tags can never disagree about X.Y.Z. Only the chart is pushed for the commit tag — the images went up by digest with the bare push. The bare tag stays, for Flux and the documented deploy procedure, and is now safe because of the serialisation. The documented deploy procedure (docs/runbook.md, docs/getting-started.md) now pins the commit tag and, after `helm upgrade`, asserts that `helm get metadata -n aether-system aether -o json | jq -r .appVersion` contains the intended commit, failing otherwise — the only check that catches a chart tag serving a different build than the one asked for. Substring, not equality: appVersion is `git describe --tags --always --long --dirty --abbrev=40`, so the sha can carry a `v1.2.3-N-g` prefix or a `-dirty` suffix. Validated: `bazel build --stamp //charts/aether:aether //charts/aether:aether_commit` produces `version: 0.92.4` and `version: 0.92.4-<40-char sha>` with the same appVersion; `bazel test //charts/...` (9/9, including the new `aether_commit_lint_test`) and `--config=lint //charts/...` pass; `scripts/check-chart-version-bump.sh` passes on the 0.92.3 -> 0.92.4 bump; all three edited workflows parse as YAML (actionlint not installed locally). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * chore(chart): bump aether chart to 0.92.5 after #711 took 0.92.4 (#692) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr --------- Co-authored-by: Claude Fable 5.1 <[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.
Follow-up to #681, which named this as residual case 3 and left it open on purpose.
The priming window
cni-installrenders aether's chained plugin entry once per agent pod start and, until now, kept it in memory only. The re-assert loop never re-renders it: it primesReasserter.entryfrom what it observes in the conflist 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.So a competing writer that strips the entry between cni-install's write and the loop's first
check()leaves the loop with nothing cached:r.entrythen stayed empty for the life of the agent process. Every later re-check found the entry missing and refused to repair. Because init containers do not re-run on a container restart, the only recovery was recreating the agent pod — akubectl delete pod, by hand, per node.It is a short window, but it is precisely the window a Talos bootstrap-manifest re-sync opens: flannel and aether-agent pods are recreated in the same event, and kube-flannel's unconditional
cp -fcan land after cni-install and before the first check (#645, the 2026-08-29 fleet-wide outage).The design
Single writer, single artifact.
cni-installwrites the entry it just chained, on its own, to/etc/cni/net.d/.aether-cni-entry. The agent only ever reads it. It is written unconditionally —--cni-conflist-reassertgoverns the loop, not the artifact — atomically viacommon/file.AtomicWrite, with the same0644the conflist gets.The entry is read back out of the merged conflist rather than from the pre-merge render, so the durable copy is byte-identical to what is actually chained (
Insertdrops the entry's owncniVersion; the enclosing conflist owns it) and a re-assert from the file reproduces the install exactly. A test pins that round trip.The observed entry always wins.
prime()is consulted only whenlen(r.entry) == 0— an observed entry is proof of what the node actually accepted, and there is no second source of truth. A file that is missing or does not parse as atype: aether-cniplugin object is ignored with a WARN and the pre-existing fail-closed path is kept verbatim; the recovery input rewrites the node's live network config, so it is trusted only after it has been proven to be what it claims.The shared contract (
EntryFilename,EntryPath,ParseEntry) lives incni/conflistalongsideInsert/Parse, so the on-disk shape cannot drift between the one-shot installer and the loop — the same reason that package exists.Why not
.json— the proofThe issue proposed
.aether-cni-entry.jsonon the grounds thatconflist.ConfigFilenamesonly considers.conf/.conflist. That is true of our loader and of kubelet, but not of the runtime that actually reads this directory.Every loader selects config files through
libcni.ConfFiles(dir, extensions), which matchesfilepath.Extagainst a caller-supplied list and does not skip dotfiles (libcni v1.3.0,libcni/conf.go:298). The lists in use:conflist.ConfigFilenames(ours), kubelet{.conf, .conflist}go-cni{.conf, .conflist, .json}LoadConf(deprecated){.conf, .json}A
.jsonfile would be selected by containerd and loaded as a single-plugin network config — and a lone aether entry is a syntactically valid one (name: aether,type: aether-cni). So.jsonis not safe, and the file is named.aether-cni-entryinstead:filepath.Ext(".aether-cni-entry")is".aether-cni-entry", which matches none of the three lists. The leading dot additionally hides it from a plainls.This is pinned by tests in both packages that run the durable file past all three extension lists via real
libcni.ConfFiles, plusConfigFilenames/ActivePath, and assert it is never selected. It is also ignored by the loop's ownisConfigEvent(same extension test), so writing it cannot trigger a re-check.What changes for the #667 fail-closed path
Nothing about the mechanisms — the taint gate still refuses to remove the startup taint while unchained, the agent still reports NotReady past the dwell, the ghost sweep still withholds eviction,
AetherCNIConflistUnchainedstill pages. What changes is what they are firing against: a state the node now heals by itself in one check (~2.5s), instead of one that structurally required an operator to delete a pod.The unrepairable state is not gone, it is narrowed: it now means the durable file is also missing or unusable. The log line changed to match — "no known-good entry could be recovered" — and the
docs/observability/alert mirror quotes the new string. The deployed GitOps rule (bpalermo/k8s-talos-main#38) still quotes the old text; it is an annotation, not an expression, so nothing misfires, and it can be refreshed on the next pass over that repo.Test matrix
cni/internal/install(TestWriteCNIConfigPersistsTheDurableEntry)JSONEqto the entry actually chained, and is a validParseEntryinput0644, matching the conflistConfigFilenames,ActivePath, orlibcni.ConfFilesunder any of the three extension listscni/conflist(newentry_test.go)EntryFilenameextension matches none of the three lists, and is dot-prefixedParseEntrytable: valid entry; not JSON; a JSON array; empty; someone else's plugin (flannel); a whole conflist rather than one entry; a non-stringtypeParseEntry→Insertround trip reproduces the chained conflist byte for byteagent/internal/cniconflist(TestPrimeFromDurableEntry)ChainStatus{Observed, Chained: true},primed known-good entry from durable filelogged; a later strip is still repaired after the file is deleted (priming lasts the process)entryempty, unchained published — the pre-existing behaviour, byte for bytethe durable aether entry is unusableExisting
reassert_test.go/state_test.go/readyz_test.gocases are unchanged and pass. Helpers (flannelOnly,chained(t),writeConf,isChained,pluginTypes) reused as-is.Talos validation recipe
The bug is about an agent process restart, not a pod restart — recreating the pod re-runs cni-install and proves nothing. The window is reproduced by stripping the conflist and killing the agent process inside the loop's 750ms settle delay, so the old process never repairs it and the new one starts with nothing observed and a stripped file.
kubectl debug node/...runs withhostPID, sopkillreaches the agent in its container;--profile=sysadminis what allows signalling it. Before this PR, step 2 logsno known-good entry was ever observedinstead and the node stays broken until the pod is deleted.Not included
Chart.yamlbump. Both thecni-installinit container and the agent container already mount the same host/etc/cni/net.d(cni-conf-dir) read-write — the init container writes the file, the agent reads it out of the directory it already watches.--cni-conflist-reassert, and it governs the loop, not the artifact.Closes #680
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr