Attach extra storage to a specific mesh node and let services use that space on that node. Storage is node-pinned: a service placed on a pool runs on the node the disk is attached to, and its volume binds there.
Node storage is optional: you add it by command, and until you do it does nothing. With
no pool registered anywhere, the platform behaves as before: the local-path provisioner
keeps its DEFAULT_PATH on the x86 host, the placement ApplicationSet has zero
elements, and the control-plane tables are empty. The node agent is baked into every
device image and enabled on every mesh node (see Bake & enable below). It is inert
by content, not by absence: with no registered pool the signed export is the empty
body, and the agent provisions nothing.
A node has spare disk (an attached SSD or HDD, an extra NVMe). You want a service (Owncast media, LocalTube downloads, a cache, a forum's uploads) to use it on that node, without redesigning cluster-wide storage. You attach and register the disk as a pool, then assign a service to it. The mesh schedules the service onto the pool's node and binds a node-local PersistentVolume there.
| Concept | Where it lives | What it is |
|---|---|---|
| pool | node_storage_pool (admin-bff changelog 085) |
an additional disk attached + registered to ONE node, with a capacity claim (reserved_bytes) and a node-local path (pool_path). |
| assignment | storage_service_assignment (085) |
an explicit (pool × service) placement: which service is pinned to the pool's node + the PVC bound to the node-pinned PV. |
| the export | GET /bff/admin/device-storage-pools/export?node=<fp> |
the signed, per-node truth the node-agent reconciles; carries ONLY that node's pools + assignments. |
| provisioning | provision_storage (keys-provision) |
a pool is just a .storage.devices[] element with a pool:{} marker; FDE is reused verbatim. |
| placement | apps/13b-node-storage.yaml ApplicationSet |
each ACTIVE assignment → one Application that injects nodeAffinity + a PVC. |
The agent is baked and enabled the same way as its twin
hugmesh-device-registry-sync:
- Baked by ALL device builders (
build-*-stage4.sh— x86 host, rpi5, frite, jetson and the six Orange Pi boards) through ONE helper,bake_node_storageinscripts/_node-storage-bake-lib.sh:/usr/sbin/hugmesh-node-storage-reconcile(0755),/usr/lib/hugmesh/storage-verify.sh(0644; sources Layer-B'sregistry-verify.sh— same Ed25519 verify + rollback guard, same bakedregistry-pub.ed25519), the OpenRC oneshot/etc/init.d/hugmesh-node-storage-reconcile(0755), and the 60s cron drop-in staged at/etc/hugmesh/registry/cron-node-storage-reconcile(0644). The x86 UNAFFILIATED (plain-desktop) image skips the whole mesh block, agent included — the only role gate on this bake. - Enabled by keys-provision (
provision_node_storage, first boot):rc-update adds the boot oneshot into the default runlevel and places the staged cron into/etc/cron.d/hugmesh-node-storage-reconcileon every mesh node (STANDALONE desktops skip it). A stale image without the baked files gets awarnand never bricks. - A test RUNS both halves:
tests/node-storage/test-bake-coverage.shexecutesbake_node_storageagainst a sandbox sysroot. The four files must exist at those exact paths, byte-identical, with those modes. It proves every builder reaches the call on a path a mesh node takes (bash's own parser supplies the enclosing branch chain, which is evaluated, and an unrecognised gate fails closed). Then it runs the REALprovision.shfirst-boot flow against the same sandbox and requires thatrc-updatewas called and the cron LANDED in/etc/cron.d. That last step pins the staged-cron name across both files: the bake writes it andprovision_node_storagereads it back in one run. The test has negative controls for each failure class (disabled, unreachable, mis-targeted, dead-enable, name drift), because the earlier grep-based version stayed green on all of them. - The admin-bff push lever ships DARK.
NODESTORAGE_RECONCILER_ENABLEDis a commented entry inspecs/cluster/manifests/admin-bff-api/deployment.yamluntil the admin-bff lane proves the exact relaxed-binding name. The pull (boot oneshot and 60s cron) is the convergence floor either way. The dark lever only defers the fast push path.
Storage is ADMIN-CAPABLE (unlike SSH licensing, which is superadmin-only) but OWNERSHIP-gated. The difference is deliberate:
| caller | node owner | node domain | result |
|---|---|---|---|
| SUPERADMIN | any | any | ALLOW (unrestricted) |
| ADMIN | ADMIN-owned | own residency | ALLOW |
| ADMIN | SUPERADMIN-owned | any | DENY (403) — superadmin-only |
| ADMIN | ADMIN-owned | another domain | DENY (403) — cross-domain |
NodeStorageService.denyReason (admin-bff) enforces this. The pool and assignment
domain come from the node's residency, never the caller ([FIX-NODEFAULT]).
- Capacity is WaitForFirstConsumer (the
hugmesh-localStorageClass) plus an API guard. An assign is rejected (422) whencommitted + requested > pool.reserved_bytes, or when anis_exclusivepool already has an active assignment. - The node agent's
dfon the attached disk is authoritative over the operator'sreserved_bytesclaim (checked at reconcile). is_exclusiveis one service per pool. The admin UI defaults it to true for video pools (AttachPoolRequest).
- Attach (admin UI →
POST .../{deviceId}/pools): register the disk as a pool on a node you own. The control plane stamps the pool's residency from the node. - Assign (admin UI →
POST .../pools/{poolId}/assignments): place a service on the pool (capacity-checked). - Provision (node-agent, on the node): the
hugmesh-node-storage-reconcileagent (boot oneshot + 60s cron) fetches the signed per-node export, verifies it (detached Ed25519 over the canonical bytes against the baked key + strict-monotonic rollback guard — the SAME verifier as the device-license registry), then:- resolves the disk by serial via
lsblk, - writes a
.storage.devices[]pool:{}manifest and runskeys-provision --pool(LUKS2 FDE reused; the pool's crypttab/fstab get,nofail).--poolis its OWN entry point inprovision.sh(provision_storage_pool), dispatched at the top ofmain()before the DONE-marker and KEYS-media gates. The agent runs on an already-provisioned node with no USB inserted, and those gates used to return 0 before any pool work. It reads the agent's manifest fromHUGMESH_PROVISION_MANIFEST(default/var/lib/hugmesh/node-storage/pool-manifest.json), never the KEYS media'sprovision.json.provision_storage --poolskips every device without apool:{}marker, so this path can never reach a system disk, - labels the node
hugmesh.net/local-path=true, - CAS-patches the local-path
nodePathMapso THIS node serves PVs from the pool path.
- resolves the disk by serial via
- Place (ArgoCD): the
13b-node-storageApplicationSet renders one Application per active assignment; it injectsnodeAffinity(pin the pod to the pool's node) + a node-pinned PVC.WaitForFirstConsumer+ the per-nodenodePathMapentry + thenodeAffinitytogether guarantee the PV binds on the correct node. - Revoke / detach (admin UI): a CAS revoke drops the assignment from the active set → the ApplicationSet prunes the placement. A pool can be detached only once it has no active assignment.
The Rancher local-path-provisioner is a DaemonSet gated on
nodeSelector: hugmesh.net/local-path=true, not a single Deployment. The control plane
(x86 host) always carries that label, so the provisioner runs there as before (full
back-compat, DEFAULT_PATH kept). A node-storage node gets the label when its first
pool is provisioned, and a provisioner instance and a per-node nodePathMap entry
come up there. local-path is a per-node provisioner keyed on the PV's selected node, so
one instance per local-path node is correct.
- A node-pinned PV has NO HA. The data lives on ONE node's disk. If that disk or node is lost, the data is lost. Use node-pinned storage for REPLACEABLE data (caches, media, downloads), NOT a primary database. The admin UI warns when you assign a database-shaped service name to a pool.
- Disk removal degrades; it never bricks. The pool's crypttab/fstab carry
,nofail, so a removed disk degrades the pool (its PVs go unavailable) and the node still boots. The node agent detects the mount loss and acksdegraded(the UI chip turns red). APodDisruptionBudget(opt-in per placement) stops a voluntary node drain from quietly taking a placed service down. - Rebalancing a running stateful service means EXPLICIT downtime and manual work.
The mesh only recommends a move. The operator confirms and runs the migration:
scale to 0 → rsync the old PV → re-point the assignment (revoke old + assign new)
→ scale back up. There is NEVER a silent auto-migration. See the
node-storage-migrate.yamlJob stub (ships suspended and inert). - FDE key custody (MVP) = a shared LUKS key + TPM2 enrolment (reused from
provision_storage/luks_open_or_format). Seedocs/ENCRYPTION-AT-REST.md. - Single-issuer clusters need
app.registry.allow-single-issuer=truefor device registration (inherited from the device-license registry guard, which already rejects adefaultresidency so the per-domain wall is non-vacuous).
- VERIFIED off-node:
- the admin-bff ownership matrix, capacity and export tests;
- the shell logic tests (
tests/node-storage/):provision_storage --pooland,nofail; the node-agent verify (accepts a genuine export; rejects unsigned, tampered, foreign and rolled-back ones); thenodePathMapCAS-patch (PV-binds-to-correct-node); the pool-manifest build; and the 13b ApplicationSet structure and selector lever; - the storage canonical-bytes reconstruction, which round-trips against the Java
NodeStorageExportService.canonicalBytesshape; - the bake and enable coverage (
test-bake-coverage.sh), which RUNS both halves against a sandbox sysroot instead of grepping for them; test-pool-entrypoint.sh, which runs the realprovision.sh --poolfrom the agent's own call site against a sandbox fake root. The pool device ends up mounted at its pool path with a,nofailfstab entry, the system disk in the same manifest is untouched, and no first-boot step or runlevel change happens.
- NEEDS A BOOTED NODE: end-to-end byte-equality with a live BFF
/exportpayload; the realprovision_storage --poolagainst a PHYSICAL disk (the sandbox stubs cryptsetup/mkfs/mount and relaxes the two[ -b ]block-device guards, so LUKS format, mkfs and the real mount are still unproven); the live PV bind + pod scheduling on the pool's node; the precise degraded/migration behaviour. - KNOWN GAP, not yet fixed: on a
--poolreconcile there is no KEYS media, soluks_keyfile()(which only looks under${BASE}, the mounted USB) returns empty and a pool disk takes the documented PLAINTEXT fallback with a WARNING. Relatedly, a pool device inherits the defaultluks_namecryptdata${i}, which can collide with a system disk's mapper name. Both need a key-custody decision (a persisted node-local pool key, and a pool-id-derived mapper name) before pools are encrypted at rest in practice.