Files
diskless-workstation/serving/fleet-manager
Audiobuzz 915a15b6a1 fleet-manager: checkpoint 1 — service skeleton + inventory store + admin API
First slice of the server-side fleet control plane (serving/fleet-manager/), the
backend for the admin SPA (monitor / authorise / lifecycle). See
docs/fleet-management-design.md + tpm-enrolment-design.md §5.

This checkpoint (stdlib-only):
- Inventory record (identity/binding/enrolled/version/health/usage/desired),
  keyed by TPM cert serial = hostnqn key, per the design's 'inventory record born
  at enrolment'. JSON-file Store (atomic writes, mutex) behind an interface so a
  DB swap is a drop-in.
- Admin plane: mTLS server verified by the DEDICATED admin CA (never the fleet CA,
  so a host cert can't reach admin) + a plaintext dev mode. JSON API:
  GET /api/hosts, GET /api/hosts/{serial}, PUT /api/hosts/{serial}/desired
  (desired-state audited to the admin client-cert CN).
- Dev seed (FLEET_MGR_SEED) so the SPA has data before real enrolment/agent flow.

Smoke-tested: list/get/desired-PUT (incl. version-drift + drain), 404s, atomic
persistence. go build + go vet + gofmt clean.

Agent gRPC plane, broker-fold-in authorise, InfluxDB metrics, and the themed SPA
follow in checkpoints 2-6.
2026-07-04 03:25:54 +00:00
..

fleet-manager — server-side fleet control plane

The management service for the diskless kiosk fleet, and the backend for the admin SPA. It is the central place to monitor, authorise, and lifecycle-control enrolled hosts. See docs/fleet-management-design.md and docs/tpm-enrolment-design.md §5.

Unlike fleet-hostapi / fleet-enrol (baked into the reproducible verity image, stdlib-only), this runs server-side as its own container on the management network, so external deps are fine (grpc-go, influxdb-client-go).

Two mTLS planes (distinct trust anchors)

Plane Transport Verifies Who Purpose
admin HTTPS + mTLS dedicated admin CA (admin-pki.sh) admin browsers JSON API + SPA (monitor / authorise / lifecycle)
agent gRPC + mTLS fleet CA (host TPM cert) enrolled hosts bidi stream: health/metrics up, desired-state down

The split is load-bearing: the agent plane uses the host's reused TPM identity cert (the same one used for 802.1X EAP-TLS and from which the NVMe hostnqn derives — "one identity, three stages"), while the admin plane uses a separate CA so an enrolled host can never reach approve/deny/lifecycle. See the identity discussion in the enrolment design §5.

Monitoring path (no host ever touches InfluxDB)

host agent ──gRPC bidi (mTLS, TPM cert)──▶ fleet-manager ──line protocol──▶ InfluxDB
           ◀──── desired-state (target ver / kiosk_url / reboot / drain) ──┘ (+ inventory health)
SPA ──GET /api/hosts/{serial}/metrics──▶ fleet-manager ──Flux──▶ InfluxDB ──JSON──▶ SPA renders charts

Hosts hold no InfluxDB credential and never reach it; the manager is the only writer/reader, holding the Influx token server-side. Identity is taken from the mTLS cert (anti-spoofing: a host can only write its own series). Push-only, no inbound host port. Graphs are rendered in the SPA, not Grafana.

Inventory record

Keyed by TPM cert serial (= hostnqn key). Born at enrolment approval, filled by the agent stream and admin action:

Host (cert_serial)
  ├─ identity : cert_serial, hostnqn, mac, ek_hash, starship_name
  ├─ binding  : asset_tag, switch_port, location        (recorded at approval)
  ├─ enrolled : approver, at, fingerprint
  ├─ version  : image_version, rootfs_digest, kernel     (agent-reported)
  ├─ health   : load, cpu, temp, tmpfs%, nvme_root, auth, selinux, chrony, kiosk  (latest snapshot; series in InfluxDB)
  ├─ usage    : kiosk_url, session_uptime, chromium_crashes, display
  └─ desired  : target_version, kiosk_url, reboot_at, drain   (SERVER-AUTHORITATIVE)

Persisted as a single JSON file (atomic writes) on a mounted volume — stdlib-only, inspectable, reproducible; a DB swap is a drop-in behind the Store interface.

API (admin plane)

Route Status
GET /healthz ✅ ckpt 1
GET /api/hosts ✅ ckpt 1 — fleet overview
GET /api/hosts/{serial} ✅ ckpt 1 — host detail
PUT /api/hosts/{serial}/desired ✅ ckpt 1 — set desired-state (audited to admin CN)
GET /api/enrol/pending, POST /api/enrol/{id}/approve|deny ⏳ ckpt 3 (drives the broker)
GET /api/hosts/{serial}/metrics ⏳ ckpt 4 (InfluxDB/Flux)

Agent plane (gRPC FleetAgent.Session bidi) — ⏳ ckpt 2.

Config (env)

Var Default Notes
FLEET_MGR_ADMIN_ADDR 127.0.0.1:9500 admin listener
FLEET_MGR_ADMIN_CERT / _KEY — admin server cert/key (mTLS)
FLEET_MGR_ADMIN_CLIENT_CA — dedicated admin CA (NOT the fleet CA)
FLEET_MGR_ADMIN_INSECURE false plaintext, no client-cert — dev only
FLEET_MGR_INVENTORY /var/lib/fleet-manager/inventory.json inventory file (mount a volume)
FLEET_MGR_SEED false inject demo hosts so the SPA has data — dev only
HOSTNQN_BASE nqn.2026-06.org.example.fleet:host- hostnqn prefix (match the broker)

Agent-plane + InfluxDB env land with their checkpoints.

Dev run

FLEET_MGR_ADMIN_INSECURE=true FLEET_MGR_SEED=true \
  FLEET_MGR_ADMIN_ADDR=127.0.0.1:9500 FLEET_MGR_INVENTORY=/tmp/inv.json \
  go run .
curl -s localhost:9500/api/hosts | jq '.hosts[] | {name:.identity.starship_name, run:.version.image_version, want:.desired.target_version, online}'

Build status

  • Checkpoint 1 (done): Go skeleton, JSON-file inventory Store, admin JSON API (monitor + lifecycle), admin mTLS wiring, dev seed. Stdlib-only.
  • Next: gRPC agent plane (ckpt 2) → authorise/broker fold-in (ckpt 3) → InfluxDB read API (ckpt 4) → themed SPA (ckpt 5) → Docker/compose + PKI + docs (ckpt 6).