nixfleet-control-plane
Role. TLS server, event-driven runtime, and persistence layer. Wraps nixfleet-reconciler’s pure decision procedure and nixfleet-state-machine’s reducer in an Axum HTTP service backed by SQLite operational state, polls the signed-artefact directory for fresh fleet.resolved.json, projects an Observed view from the database, dispatches Actions by emitting agent-facing wire bodies, and persists everything per RFC-0006 (single-MPSC runtime, applier-co-write derived views). Carries the routing-and-state-storage half of the agent / CP protocol; the agent never talks to anything else.
Key types. TickInputs / TickOutput / VerifyOutcome / VerifyOk (one reconciler iteration’s input bundle and result), AppState (server-wide handle wiring Mutex<rusqlite::Connection> sized for O(100) hosts, the verified-fleet snapshot, the signed-artefact poller, the freshness window, the optional Prometheus registry), the polling timer (re-verifies the on-disk artefact at signing_interval_minutes cadence), the rollouts-source (resolves a manifest into the per-channel dispatch plan). The CP-mirror of per-host and per-rollout state runs through nixfleet_state_machine::step(); persistence is the host_rollout_records reducer cache plus the dispatch_history log used by /v1/rollouts/{id}/trace.
Surface. Library: tick(&TickInputs) -> Result<TickOutput> (one reconciliation iteration) and render_plan(&TickOutput) -> String (JSONL summary - one tick line plus one line per action, with offline Skips coalesced into a skip_summary). Binary: HTTP routes under /v1/agent/* (events, heartbeat, dispatch, renew), /v1/enroll, /v1/whoami, /v1/hosts, /v1/channels/{name}, /v1/rollouts, /v1/rollouts/{id}, /v1/rollouts/{id}/trace, /v1/deferrals, /metrics, /healthz. NixOS module services.nixfleet-control-plane.{enable, listen, tls.{caCert, certFile, keyFile}, trustFile, ...} materialises the nixfleet-control-plane.service systemd unit.
Links.
- Generated rustdoc:
api/nixfleet_control_plane/ - Relevant RFCs: RFC-0002, RFC-0003, RFC-0005, RFC-0006, RFC-0008, RFC-0011
- Architecture component: §1.4 Control plane, §3 The main flow