docs: the start gate describes what the pod runs
This commit is contained in:
parent
de85c18a33
commit
f3d96d450e
1 changed files with 66 additions and 36 deletions
|
|
@ -33,7 +33,7 @@ The command moves the swarm's own daemons and the queue into the cluster:
|
|||
| `services.hyperhive.deploy.<svc>.runtime` | `"host"` or `"k8s"`, per service |
|
||||
| `/etc/hyperhive/migrate.json` | the module's render of each service's runtime, state paths, PVC |
|
||||
| `/var/lib/hyperhive-migrate/` | host record: pre-move snapshots and copy digests, root `0700` |
|
||||
| `.hyperhive-migrated` in a PVC | the copy marker the pod's start gate waits for |
|
||||
| `.hyperhive-migrated` in a PVC | the copy marker the pod's start gate checks for |
|
||||
| `swarmctl migrate` `status` / `rollback` / `finish` | the verbs |
|
||||
|
||||
## The move of one stateful service
|
||||
|
|
@ -50,8 +50,12 @@ A service with state moves in four steps. A service without state skips steps
|
|||
2. **Cut-over rebuild** (the operator). The operator sets
|
||||
`deploy.<svc>.runtime = "k8s"` and rebuilds. The rebuild stops the host
|
||||
unit and renders it no more, and applies the workload and its PVC. The
|
||||
pod starts in a **start gate**: an init container that waits until the
|
||||
PVC holds `.hyperhive-migrated`. A pod therefore never starts on an empty
|
||||
pod's first init container is the **start gate**. It exits 0 only when the
|
||||
PVC holds `.hyperhive-migrated`, or when the PVC is empty and the
|
||||
service's `deploy.<svc>.k8s.freshState` is on. Any other volume fails the
|
||||
gate: the pod stays in `Init:Error` with one line saying to run
|
||||
`swarmctl migrate <svc>` or set the option, and the kubelet runs the gate
|
||||
again with a growing delay. A pod therefore never starts on an empty
|
||||
volume, whatever re-applies the manifest.
|
||||
3. **Copy** (`swarmctl migrate`). Refuses while the host unit runs. Streams
|
||||
the host state directory as a tar archive into a copy pod that mounts the
|
||||
|
|
@ -62,9 +66,10 @@ A service with state moves in four steps. A service without state skips steps
|
|||
4. **Verify** (`swarmctl migrate`). Waits for the pod's readiness, then
|
||||
compares what the service serves against the snapshot from step 1.
|
||||
|
||||
The copy pod and the start gate run a small `swarmctl` image with the hidden
|
||||
subcommands `migrate receive` and `migrate gate`. The service images carry no
|
||||
shell and no `tar`, and this keeps them that way. The copy streams through the
|
||||
The copy pod runs a small `swarmctl` image with the hidden subcommand
|
||||
`migrate receive`. The start gate is a script in an image of its own that holds
|
||||
coreutils and nothing else. The service images carry no shell and no `tar`, and
|
||||
this keeps them that way. The copy streams through the
|
||||
k8s API instead of writing into the volume's directory on the host, so it works
|
||||
for every storage class.
|
||||
|
||||
|
|
@ -79,7 +84,7 @@ endpoints the [services page](../../2-handbook/swarm/services.md) lists; the
|
|||
| `swarm-notify-router` | in the queue: a state bucket and a durable consumer on the forge events stream | nothing | `/readyz`: queue connected | `runtime = "k8s"`, rebuild; back with `runtime = "host"` |
|
||||
| `swarm-review-classifier` | none on disk; its runs and settings live in buckets the controller owns | nothing | `/readyz`: queue connected | same |
|
||||
| `swarm-claude-login` | none; credentials it writes go to the store | nothing; a login in progress ends | `/readyz`: queue connected | same |
|
||||
| `swarm-stt` | the transcript cache, entries live 24 h | nothing; the pod starts with an empty cache | `/readyz`: queue connected | same |
|
||||
| `swarm-stt` | the transcript cache, entries live 24 h | nothing; the pod starts with an empty cache, once the gate has its marker | `/readyz`: queue connected | same |
|
||||
| `swarm-ci-metrics` | `cursor.json` in the state directory; losing it re-pushes every run | the state directory, to a PVC | the CronJob's next Job completes | `runtime = "k8s"`, rebuild; the timer goes, the CronJob runs. Rollback copies the PVC back |
|
||||
| NATS + `swarm-nats-auth` | JetStream's `store_dir`: the swarm's desired state, operator profiles, schedules and run records. `swarm-nats-auth` keeps nothing | the whole `store_dir`, to a PVC; the cut-over rebuild stops NATS, so the copy reads a quiescent tree | nats-server's `/healthz?js-enabled-only=true` and `swarm-nats-auth`'s `/readyz`; Ready when both pass | `runtime = "k8s"`, rebuild; the pod takes the same host port, so hives keep their URL. Rollback copies the PVC back |
|
||||
| `swarm-controller` | its state directory: the operator-admin set, the legacy `webhook-secret` fallback and the forge avatar markers. The rest sits in the queue or the store | the state directory, to a PVC | `/readyz` on the controller's plain health listener | `runtime = "k8s"`, rebuild; the same rebuild points the gateway's `/api/` and `/webhook/forge/` upstreams at the controller's TCP listener. Rollback copies the PVC back and returns the upstreams to the socket |
|
||||
|
|
@ -201,8 +206,11 @@ directories and the PVC of any service back on the host. It runs only when
|
|||
every service passed verification where the config wants it. A rebuild that
|
||||
stops a workload leaves its PVC in place, so the data survives until `finish`.
|
||||
|
||||
A fresh install straight onto k8s has no host state to copy: `swarmctl migrate`
|
||||
writes a marker that names no source, and the gate opens.
|
||||
A fresh install straight onto k8s has no host state to copy: with
|
||||
`deploy.<svc>.k8s.freshState` on, the gate marks the empty volume itself
|
||||
(`{"fresh": true, "at": <time>}`), and `swarmctl migrate` isn't needed. A
|
||||
service with state that moves nothing, `swarm-stt`, still needs the marker:
|
||||
`swarmctl migrate` writes one that names no source.
|
||||
|
||||
## Downtime and what hives see
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue