From 4133ab511a4b5aadc41516f3a5194684a25cd9a1 Mon Sep 17 00:00:00 2001 From: Quinn Groves Date: Sun, 29 Nov 2026 09:57:57 -0500 Subject: [PATCH] docs: design the flightctl fleet plane migration --- docs/FLIGHTCTL-MIGRATION.md | 140 ++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 docs/FLIGHTCTL-MIGRATION.md diff --git a/docs/FLIGHTCTL-MIGRATION.md b/docs/FLIGHTCTL-MIGRATION.md new file mode 100644 index 0000000..5c6a959 --- /dev/null +++ b/docs/FLIGHTCTL-MIGRATION.md @@ -0,0 +1,140 @@ +# Replacing KubeStellar with flightctl in Mjolnir — synthesized design + +## Goal and invariants + +Make flightctl the fleet plane and remove KubeStellar, without adding a shell, +interpreter, Containerfile, mutable source pin, or secret to the bootc image, +and without weakening the signed-UKI boot chain. Kubernetes stays upstream +kubeadm 1.37.3. `bootc upgrade --download-only` plus kured stays the only OS +update path. Every change lands as a topic-branch PR targeting `testing` with +a completed green `image` check. + +## 1. Target composition and ownership + +On each node, from FSDK via BuildStream: a sha256-pinned `flightctl-agent` Go +ELF with a direct `ExecStart=`, a config template, and a compiled helper that +materialises enrollment material from systemd credentials into +`/etc/flightctl` (0600). No container runtime, no Sigstore policy file, no +interpreter. The compiled `io.mjolnir.Fleet` Varlink service stays as the +local diagnostics and action surface over the existing mTLS bridge; only its +publisher transport changes. + +On the cluster: kubeadm control plane and workers, Cilium, kured, and nothing +else fleet-related. Kured moves out of the Console plugin into +`files/manifests/kured/` before KubeStellar is deleted, so the reboot lock +survives the cutover. + +Off-node on an operator-provisioned host: flightctl api, worker, periodic, +remote-access, db-migrate, PostgreSQL, Redis and flightctl-ui as digest-pinned +Podman quadlets under `flightctl.target`. Podman and RPM on that host are +operator infrastructure outside the image and break no hard rule. That host +owns the Device registry, fleet templates, attestation verdicts and the UI. + +State ownership: flightctl owns desired configuration and applications; +etcd owns cluster state; the signed UKI and composefs digest own image +identity and measured boot; the off-node verifier owns `attestation.verified`. +A node can never set its own verdict. + +## 2. Server placement: off-node quadlets + +Helm `oci://quay.io/flightctl/charts/flightctl` on the kubeadm cluster is +viable on 1.37.3, but it adds Gateway API CRDs, cert-manager, PostgreSQL, +Redis and five server images to the pinned graph and puts the fleet plane in +the same failure domain as the single control plane it manages. etcd loss, a +failed sealed upgrade, or a factory reset would blind fleet management and +attestation exactly when recovery needs them. + +Off-node quadlets need one additional host and a network path from nodes, but +keep the fleet plane available during cluster rebuild, remove the extra +controllers from the image graph, and match flightctl's supported +non-Kubernetes install. Rejected: server on a Mjolnir node (would put Podman +and server components in the image). flightctl-ansible is out of scope; it +runs on an operator host and adds nothing to the image. + +## 3. Data model migration + +Delete the `MjolnirNode` CRD. A flightctl `Device` name equals the hostname +and the mTLS certificate subject. + +| MjolnirNode field | Device target | +| --- | --- | +| `spec.role` | label `mjolnir.io/role` | +| `spec.varlinkEndpoint` | annotation `mjolnir.io/varlink-endpoint` | +| `status.image`, `version`, `updateAvailable`, `pendingDeployment` | `status.os` plus annotations for the staged bootc deployment | +| `rebootRequired`, `rebootLock`, `rebootDeferred` | annotations `mjolnir.io/reboot-*`; kured keeps the lock | +| `status.attestation.*` | annotation `mjolnir.io/attestation-evidence`: PCR 11, event log hash, UKI PE hash, composefs digest, image digest | +| `status.attestation.verified` | annotation `mjolnir.io/attestation-verified`, written only by the off-node verifier | + +`mjolnir-fleet publish` stops patching a Kubernetes object and calls the +flightctl API over mTLS. Varlink method names and JSON shapes stay unchanged, +so `tests/test_fleet_varlink.py` keeps asserting behavior. `Upgrade` still +calls `bootc upgrade --download-only`; `Reboot` still writes the kured +sentinel. `scripts/verify-attestation.py` keeps its comparison logic and +changes only its write target; missing PCR, event log, UKI or image digest +yields `verified: false` (hard rule 12). The multinode WDS-to-ITS propagation +check becomes a Device sync check. No compatibility mirror of MjolnirNode is +kept: two fleet state stores would drift. + +## 4. Update and signature story + +flightctl is bootc-native, but its OS path is `podman pull` with Sigstore +verification from `/etc/containers/policy.json`. Mjolnir's path is `bootc +upgrade --download-only`, a cosign-keyless bootc signature policy, kured +drain-and-reboot, and a composefs digest pinned inside the signed UKI. + +Verified from upstream source: leaving the OS target unset is supported. +`internal/agent/device/device.go:afterUpdateOS` returns early with "No OS +image to update" when `desired.Os == nil`, and the fleet docs describe +templates with no `spec.os.image` that apply only config and applications. +The agent therefore never invokes Podman and the image carries no policy file. +Device specs carry configuration and applications only; a desired OS version, +if an operator records one, is an annotation translated by the operator into +a digest-pinned image in `include/versions.yml`. + +Rejected: giving flightctl OS updates. Even with a shared containers/image +policy, that path would need a designed way to replace the signed UKI that +pins the composefs digest, would put Podman in the image, and would duplicate +the reboot controller. Rejected: running both paths in parallel; two pull +paths and two reboot controllers race. + +## 5. Ordered, independently landable units + +Each unit is one topic-branch PR targeting `testing`, gated on `just +validate`, `just test`, `just lint` and a completed green `image` check. + +1. **Pins.** Add agent sha256 for amd64 and arm64, server/UI/database digests + and the chart digest to `include/versions.yml`; extend the pin test. + Gate: pin test rejects any tag; no runtime change. +2. **Relocate kured.** Move `plugins/console/manifests/kured.yaml` to + `files/manifests/kured/` and update `cmd_apply`. Gate: boot test shows the + DaemonSet still running after the move. +3. **Subtract KubeStellar.** Delete manifests elements and files, Console + card, CRDs, RBAC, `install-console-card.sh`, the WDS-to-ITS check and the + two version entries. Gate: no KubeStellar path in `git grep`, fleet Varlink + tests pass, green image check. +4. **Add the agent.** BuildStream element, shell-free unit, credential- + templated config with no OS desired state. Gate: `test_image_contents.py`, + `test_units.py`, boot test shows the agent online. +5. **Stand up the fleet host.** Digest-pinned quadlets and provisioning docs; + no secret in git. Gate: `flightctl.target` converges and nodes enroll with + mTLS. +6. **Repoint publisher and verifier** to Devices with evidence rules intact. + Gate: `test_fleet_varlink.py` and verifier tests pass; a report missing PCR + 11 yields `verified: false`. +7. **UI and docs.** Deploy pinned `flightctl-ui`; update README, + ARCHITECTURE sections 1, 2 and 7, BUILD and SECURITY. Gate: no stale + references; final green image check. + +## 6. Risks and falsifiers + +- No operator-provided fleet host: if one cannot be provisioned, the Helm + path must be reconsidered. +- Device API cannot hold arbitrary attestation evidence: if the API rejects + the evidence fields, an out-of-band verdict store is required. +- arm64 agent asset missing: no arm64 checksum in `versions.yml` would leave + aarch64 unbuildable, as it is today. +- Enrollment must bootstrap from TPM PCR 7 and signed PCR 11; any committed + key file falsifies the credential-only design. +- A config or application rollout can break kubeadm before kured drains; + gate application rollout behind preflight. +