k8s: the controller pod keeps no volume; the state gate goes
This commit is contained in:
parent
b69f8c1de0
commit
513be8f7d0
3 changed files with 233 additions and 1110 deletions
|
|
@ -1,15 +1,15 @@
|
|||
# Moving an all-local swarm onto k8s: `swarmctl migrate`
|
||||
|
||||
`swarmctl migrate` moves a running all-local swarm
|
||||
(`services.hyperhive.deploy.singleHostSwarm`) onto the k3s cluster on the
|
||||
same host. It copies each service's state into a persistent volume, checks the
|
||||
copy, and leaves the host copy in place until the operator finishes. It moves
|
||||
services in dependency order, resumes after a crash, and rolls a service back
|
||||
to the host on request.
|
||||
A running all-local swarm (`services.hyperhive.deploy.singleHostSwarm`) moves
|
||||
onto the k3s cluster on the same host one service at a time. The operator sets
|
||||
`deploy.<svc>.runtime = "k8s"` and rebuilds; `swarmctl migrate status` reports
|
||||
where each service stands. Nothing copies a service's state: each one's pod
|
||||
re-derives what it keeps, keeps it in the service's own store, or uses the host
|
||||
unit's directory in place.
|
||||
|
||||
## Scope and guarantees
|
||||
|
||||
The command moves the swarm's own daemons and the queue into the cluster:
|
||||
The swarm's own daemons and the queue move into the cluster:
|
||||
`swarm-notify-router`, `swarm-review-classifier`, `swarm-claude-login`,
|
||||
`swarm-stt`, `swarm-ci-metrics`, NATS with `swarm-nats-auth`, and
|
||||
`swarm-controller`. bao, the forge, authelia, the gateway, `swarm-builder`,
|
||||
|
|
@ -18,59 +18,39 @@ The command moves the swarm's own daemons and the queue into the cluster:
|
|||
- **The hive contract stays the same.** Hives and agents keep the NATS URL,
|
||||
its port, its certificate name and its auth callout. No hive needs a
|
||||
rebuild for any move.
|
||||
- **The host copy of the state stays on disk** until the operator runs
|
||||
`swarmctl migrate finish`. A forward move only reads it, so a rollback
|
||||
always has it to return to.
|
||||
- **One nix option decides where a service runs.** `deploy.<svc>.runtime` is
|
||||
`"host"` (the default) or `"k8s"`. The cut-over is an operator rebuild,
|
||||
never a runtime toggle that `swarmctl` flips on its own.
|
||||
- **A move leaves the host's data alone.** The host unit's directories stay
|
||||
where they're, so going back is `runtime = "host"` and a rebuild.
|
||||
|
||||
### Names
|
||||
|
||||
| name | what it names |
|
||||
| --------------------------------------------------- | --------------------------------------------------------------- |
|
||||
| `services.hyperhive.deploy.k8s.enable` | brings up single-node k3s on the swarm host |
|
||||
| `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` |
|
||||
| `SWARMCTL_KUBECTL`, `SWARMCTL_KUBECONFIG` | the `swarmctl` wrapper's `kubectl` and the k3s admin kubeconfig |
|
||||
| `.hyperhive-migrated` in a PVC | the copy marker the pod's start gate checks for |
|
||||
| `swarmctl migrate` `status` / `rollback` / `finish` | the verbs |
|
||||
| name | what it names |
|
||||
| ----------------------------------------- | --------------------------------------------------------------- |
|
||||
| `services.hyperhive.deploy.k8s.enable` | brings up single-node k3s on the swarm host |
|
||||
| `services.hyperhive.deploy.<svc>.runtime` | `"host"` or `"k8s"`, per service |
|
||||
| `/etc/hyperhive/migrate.json` | the module's render of each service's runtime and host units |
|
||||
| `SWARMCTL_KUBECTL`, `SWARMCTL_KUBECONFIG` | the `swarmctl` wrapper's `kubectl` and the k3s admin kubeconfig |
|
||||
| `swarmctl migrate status` | the one verb: a read-only report |
|
||||
|
||||
## The move of one stateful service
|
||||
## `swarmctl migrate status`
|
||||
|
||||
A service with state moves in four steps. A service without state skips steps
|
||||
2 and 3.
|
||||
It reads `/etc/hyperhive/migrate.json`, asks systemd whether each service's
|
||||
host units run, and lists the pods of the swarm's namespace with one
|
||||
`kubectl get`. It creates and changes nothing. For each service it reports:
|
||||
|
||||
1. **Snapshot** (`swarmctl migrate`, before the rebuild). Records what the
|
||||
service holds while its host unit still runs, for the check in step 4: a file
|
||||
list with sizes of the state directory. The record goes to
|
||||
`/var/lib/hyperhive-migrate/<svc>.json`.
|
||||
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'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
|
||||
PVC, into `.incoming/`. Checks the digest of the unpacked tree against the
|
||||
source, moves `.incoming/` into place, sets ownership to the image's user,
|
||||
and writes `.hyperhive-migrated` last, with the source path and digest.
|
||||
The gate opens.
|
||||
4. **Verify** (`swarmctl migrate`). Waits for the pod's readiness, then
|
||||
compares what the service serves against the snapshot from step 1.
|
||||
- **runtime**: whether the host units have stopped when the configuration says
|
||||
`k8s`, and whether the cluster still holds a pod of a service the
|
||||
configuration puts on the host;
|
||||
- **order**: whether the service moved before one that comes earlier in the
|
||||
[order of moves](#order-of-moves);
|
||||
- **ready**: whether the newest pod's readiness probe passes (a `CronJob`'s pod
|
||||
finishes when its Job completed).
|
||||
|
||||
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.
|
||||
It names the next step that isn't done, exits 0 when every check ran, and
|
||||
exits 1 when a check failed to run. `--json` prints the services as the module
|
||||
renders them, every step with its status, and the next step.
|
||||
|
||||
## Services
|
||||
|
||||
|
|
@ -78,15 +58,15 @@ for every storage class.
|
|||
endpoints the [services page](../../2-handbook/swarm/services.md) lists; the
|
||||
[readiness page](../swarm/readiness.md) has their mechanics.
|
||||
|
||||
| service | state | what moves | readiness signal | cut-over and rollback |
|
||||
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `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; the pod keeps it in an `emptyDir` | nothing; the pod starts with an empty cache | `/readyz`: queue connected | same |
|
||||
| `swarm-ci-metrics` | `cursor.json` in the state directory; losing it re-pushes every run | nothing; the pod starts on an empty PVC with no gate, and its first pass re-pushes every run as the same points | the CronJob's next Job completes | `runtime = "k8s"`, rebuild; the timer goes, the CronJob runs; back with `runtime = "host"` |
|
||||
| NATS + `swarm-nats-auth` | JetStream's `store_dir`: the swarm's desired state, operator profiles, schedules and run records. `swarm-nats-auth` keeps nothing | nothing; the pod mounts the container's `store_dir` in place | 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 is `runtime = "host"` and a rebuild: the same files |
|
||||
| `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 |
|
||||
| service | state | what the pod starts with | readiness signal | cut-over and rollback |
|
||||
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `swarm-notify-router` | in the queue: a state bucket and a durable consumer on the forge events stream | the queue's | `/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 | the queue's | `/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; the pod keeps it in an `emptyDir` | an empty cache | `/readyz`: queue connected | same |
|
||||
| `swarm-ci-metrics` | `cursor.json` in the state directory; losing it re-pushes every run | an empty claim: the first pass re-pushes every run as the same points | the CronJob's next Job completes | `runtime = "k8s"`, rebuild; the timer goes, the CronJob runs; back with `runtime = "host"` |
|
||||
| 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 host unit's own `store_dir`, in place | 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 is `runtime = "host"` and a rebuild: the same files |
|
||||
| `swarm-controller` | its state directory holds the legacy `webhook-secret` (the store has it too), the forge avatar markers and, once, a legacy operator-admin file; the grant record is in the queue's key-value store | an `emptyDir` | `/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. Back with `runtime = "host"` and a rebuild |
|
||||
|
||||
Two facts the table rests on:
|
||||
|
||||
|
|
@ -96,11 +76,12 @@ Two facts the table rests on:
|
|||
the same files, so a switch in either direction copies nothing, and the
|
||||
streams, consumers and acknowledgements are the ones the other side left.
|
||||
See [the queue's store](#the-queues-store).
|
||||
- **The webhook secret lives in the store.** The state directory's
|
||||
`webhook-secret` is a fallback the controller reads only when the store
|
||||
doesn't answer. The copy moves it anyway, so a pod that starts while the
|
||||
store is down still verifies forge deliveries. Preflight checks that the
|
||||
store holds the secret.
|
||||
- **The controller keeps no state of its own that a move could lose.** The
|
||||
record of the Matrix admin grants is in the queue's key-value store, the
|
||||
webhook secret is in the secret store, and the controller sets the avatar
|
||||
markers again at start. The first start of the controller on the host after
|
||||
an upgrade imports a legacy grant file into the store, so run the host
|
||||
controller once before the switch.
|
||||
|
||||
## The queue's store
|
||||
|
||||
|
|
@ -130,17 +111,17 @@ The claim `swarm-nats-store` binds it by name, so nothing else binds either.
|
|||
|
||||
## Order of moves
|
||||
|
||||
`swarmctl migrate` moves the services in this order:
|
||||
`swarmctl migrate status` reports the services in this order, and flags a
|
||||
service that moved ahead of an earlier one:
|
||||
|
||||
1. **`swarm-notify-router` alone.** The first cut-over proves the runtime
|
||||
switch, the image, the store identity and reaching the host-run NATS by
|
||||
name, with nothing to copy.
|
||||
name.
|
||||
2. **`swarm-review-classifier`, `swarm-claude-login`, `swarm-stt`,
|
||||
`swarm-ci-metrics`**, in one rebuild or one at a time. Nothing to copy, same
|
||||
pattern as step 1: the pods start with no gate on an empty volume.
|
||||
3. **NATS with `swarm-nats-auth`.** The riskiest move: every hive and
|
||||
agent disconnects, and the data is the swarm's desired state. Nothing is
|
||||
copied, and the controller is the only service `swarmctl migrate` copies.
|
||||
`swarm-ci-metrics`**, in one rebuild or one at a time, the same pattern as
|
||||
step 1.
|
||||
3. **NATS with `swarm-nats-auth`.** The riskiest move: every hive and agent
|
||||
disconnects, and the data is the swarm's desired state. Nothing copies it.
|
||||
`swarm-nats-auth` moves in the same pod, because it answers the auth
|
||||
callout on every connect and dials the server by name, which the pod's
|
||||
host aliases map to its loopback.
|
||||
|
|
@ -150,101 +131,14 @@ The claim `swarm-nats-store` binds it by name, so nothing else binds either.
|
|||
the NATS move, and `swarmctl` keeps its local socket for the checks.
|
||||
- Its cut-over also changes the gateway's upstream and ends the local
|
||||
socket for `swarmctl`, the widest change to the operator's tools.
|
||||
- Its state is small, so its rollback is cheap.
|
||||
|
||||
Each step needs the previous one Ready and verified. `swarmctl migrate` says
|
||||
which service comes next, and refuses to copy a service out of order unless
|
||||
the operator passes `--out-of-order`.
|
||||
|
||||
## Preflight
|
||||
|
||||
`swarmctl migrate` runs these before its first snapshot, and again before each
|
||||
copy. A failed check names what's missing and stops; it changes nothing.
|
||||
|
||||
| check | how | fails when |
|
||||
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
|
||||
| k3s node Ready | `kubectl get nodes` with the k3s admin kubeconfig | the node is NotReady, or `deploy.k8s.enable` is off |
|
||||
| images present | every image the next move needs shows in the node's image list | an image is missing |
|
||||
| store login from a pod | a short-lived probe pod with the next service's identity logs in to bao and reads one path that service may read | the login or the read fails |
|
||||
| host services reachable | the probe pod resolves the bao, forge, authelia and collector names to the node and completes TLS to each; while NATS runs on the host, NATS too | a name doesn't resolve, or a handshake fails |
|
||||
| disk space | free space on the filesystem behind the PVCs is at least twice the sum of the state still to copy, plus 1 GiB | not enough room for the copy and a later rollback copy |
|
||||
| host unit state | the service's host unit is active before the snapshot, and inactive before the copy | the order of steps doesn't hold |
|
||||
| webhook secret in the store (controller only) | the controller's store path for it holds a value | the store has none; the operator restarts the host controller first, which seeds it |
|
||||
| controller listener (controller only) | the controller's TCP listener answers a client holding the gateway leaf, and refuses one without | the listener is off or refuses the gateway |
|
||||
|
||||
## Resume and rollback
|
||||
|
||||
`swarmctl migrate` keeps no progress file of its own. Like `swarmctl setup`, it
|
||||
observes the system, judges each step as done, not done or unknown from what it
|
||||
sees, and plans again after every step. A rerun resumes where the last run
|
||||
stopped, and the loop offers retry, skip or quit on a failed step.
|
||||
|
||||
### What's observed and what's recorded
|
||||
|
||||
| fact | observed from |
|
||||
| ---------------------------------- | ---------------------------------------------------------- |
|
||||
| where the config wants the service | `/etc/hyperhive/migrate.json`, which the rebuild renders |
|
||||
| host unit active or not | `systemctl is-active` |
|
||||
| workload, pod phase, Ready | `kubectl` |
|
||||
| copy done | the pod's `state-gate` init container, in the pod's status |
|
||||
|
||||
`swarmctl migrate status` reads the gate's answer from the pod's status: the
|
||||
gate exited 0 when the marker is in the volume, and a refusal puts its reason
|
||||
in the container's termination message. Status never starts a pod, so it
|
||||
creates nothing and reads only.
|
||||
|
||||
Two facts vanish once the host unit stops, so `/var/lib/hyperhive-migrate/`
|
||||
records them: the step 1 snapshot, and the digest of the copied tree. Without
|
||||
a snapshot, step 4 falls back to the stream names on disk and says so.
|
||||
|
||||
### Idempotence
|
||||
|
||||
- The snapshot overwrites its record while the host unit runs, and refuses to
|
||||
once it stops.
|
||||
- The copy starts by emptying `.incoming/`, and runs only while the marker is
|
||||
absent. Rerunning it after an interrupted copy starts over.
|
||||
- A rerun skips a copy whose marker exists.
|
||||
- Verification only reads.
|
||||
- `rollback` and `finish` check their own preconditions and skip what's done.
|
||||
|
||||
### Half-done migrations
|
||||
|
||||
| what the operator sees | resume | roll back |
|
||||
| ------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------- |
|
||||
| rebuilt, the pod waits in its gate, no marker | `swarmctl migrate` copies | `runtime = "host"`, rebuild; the host state never changed |
|
||||
| `.incoming/` in the PVC, no marker (copy cut off) | `swarmctl migrate` empties it and copies again | same as above |
|
||||
| marker written, pod not Ready | read the pod's log; fix, then `swarmctl migrate` verifies | `swarmctl migrate rollback <svc>`, then `runtime = "host"`, rebuild |
|
||||
| Ready, verification failed | the mismatch says what differs; the operator decides | same as above |
|
||||
| verified | nothing to do | same as above |
|
||||
|
||||
`swarmctl migrate rollback <svc>` works in this order:
|
||||
|
||||
1. Removes the marker and deletes the pod. The replacement waits in the gate,
|
||||
so nothing writes to the PVC from here on, whatever re-applies the
|
||||
manifest.
|
||||
2. Copies the PVC into `<host dir>.from-k8s` and checks its digest.
|
||||
3. Renames the host directory to `<host dir>.pre-rollback` and
|
||||
`<host dir>.from-k8s` to the host directory, owned by the host unit's
|
||||
user. Both renames stay on one filesystem.
|
||||
4. Tells the operator to set `runtime = "host"` and rebuild, then verifies
|
||||
the host unit's readiness after that rebuild.
|
||||
|
||||
The rollback copies back because every write after the cut-over exists only
|
||||
in the PVC.
|
||||
|
||||
`swarmctl migrate finish` deletes the host copies, the `.pre-rollback`
|
||||
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: with
|
||||
`deploy.<svc>.k8s.freshState` on, the gate marks the empty volume itself
|
||||
(`{"fresh": true, "at": <time>}`), and `swarmctl migrate` isn't needed.
|
||||
Each step needs the previous one Ready. `swarmctl migrate status` says which
|
||||
service comes next.
|
||||
|
||||
## Downtime and what hives see
|
||||
|
||||
The budget is the time from the cut-over rebuild stopping the host unit to the
|
||||
pod passing step 4.
|
||||
pod being Ready.
|
||||
|
||||
| service | budget | what hives, agents and the operator see |
|
||||
| ------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ its systemd unit, and nothing applies the services' manifests: two copies of
|
|||
`swarm-notify-router`, `swarm-ci-metrics` or `swarm-controller` would share one
|
||||
queue consumer, one cursor or one swarm. A service's objects go into the
|
||||
cluster when its `runtime` is `"k8s"` ([the runtime switch](runtime.md), which
|
||||
[`swarmctl migrate`](migrate.md) drives).
|
||||
[`swarmctl migrate status`](migrate.md) reports).
|
||||
|
||||
With the option off, the host's configuration is the one it has without the
|
||||
module.
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@ cluster follow the same pattern.
|
|||
rule. One switch covers the queue's server and its auth callout. It needs
|
||||
the iptables firewall (`networking.nftables.enable` off).
|
||||
[The queue](#the-queue) has its own section.
|
||||
- `services.hyperhive.deploy.<service>.k8s.freshState` (default `false`) for
|
||||
the service whose pod keeps state worth moving in a volume:
|
||||
`swarm-controller`. It says whether the pod may start on an empty
|
||||
volume ([State](#state)).
|
||||
|
||||
With `"host"`, a host without [the cluster node](node.md) renders the same
|
||||
configuration as before the option existed. With the node on and every service
|
||||
|
|
@ -104,27 +100,14 @@ Job:
|
|||
|
||||
A failed step fails the unit, and the host unit doesn't start: the service stays
|
||||
down and never doubles. A rerun resumes from the renamed link. Persistent volume
|
||||
claims stay; `swarmctl migrate finish` deletes them.
|
||||
claims stay until the operator deletes them.
|
||||
|
||||
## State
|
||||
|
||||
A pod with a state volume that holds state worth moving (`swarm-controller`)
|
||||
starts only on migrated state. Its first init container, `state-gate`, mounts
|
||||
the volume and exits 0 when the volume holds `.hyperhive-migrated`. A volume
|
||||
with no entries besides `lost+found` gets the marker (`{"fresh": true, "at":
|
||||
<time>}`) and passes where the service's `k8s.freshState` is on. Every other
|
||||
volume fails the gate, including one that holds files and no marker, since a
|
||||
copy may have stopped half way. The pod stays in `Init:Error`, and the
|
||||
container's termination message and log carry one line that names the service,
|
||||
the `swarmctl migrate` command and the option to set for a fresh install.
|
||||
Nothing of the service runs on the empty volume. The gate doesn't decide which
|
||||
copy runs: the host unit stops before the pod exists. Switching a stateful
|
||||
service to `"k8s"` on a live host therefore needs `swarmctl migrate`, which
|
||||
copies the state and writes the marker, or the fresh flag, which is for a swarm
|
||||
with no state to lose. `swarm-notify-router`, `swarm-review-classifier` and
|
||||
`swarm-claude-login` have no volume and no gate, `swarm-stt` and
|
||||
`swarm-ci-metrics` have a volume that the gate doesn't check, and the queue's
|
||||
volume is the host unit's own directory.
|
||||
No pod starts behind a gate that checks its state volume: a service keeps
|
||||
nothing a switch has to copy. Each service's state is below.
|
||||
`swarm-notify-router`, `swarm-review-classifier` and `swarm-claude-login` have
|
||||
no volume.
|
||||
|
||||
`swarm-notify-router` keeps nothing on the host. Its durable consumer on the
|
||||
forge events stream and its `notify-router-state` bucket live in the queue, so a
|
||||
|
|
@ -132,22 +115,20 @@ switch in either direction copies nothing, and the router continues from the
|
|||
consumer's position.
|
||||
|
||||
`swarm-stt` keeps a transcript cache, which lives 24 hours. On the host the
|
||||
cache sits in the container's `/var/lib/swarm-stt`. In the cluster it sits in
|
||||
an `emptyDir` at the same path, so the pod has no claim and no gate and starts
|
||||
on an empty cache on every start of the pod. A switch copies nothing, and the
|
||||
service transcribes a memo that only the other side cached. The whisper model
|
||||
isn't state: the pod's image holds it, from the same store path the container
|
||||
reads.
|
||||
cache sits in the container's `/var/lib/swarm-stt`. In the cluster it sits in an
|
||||
`emptyDir` at the same path, so the pod has no claim and starts on an empty
|
||||
cache on every start of the pod. A switch copies nothing, and the service
|
||||
transcribes a memo that only the other side cached. The whisper model isn't
|
||||
state: the pod's image holds it, from the same store path the container reads.
|
||||
|
||||
`swarm-ci-metrics` keeps a cursor, `cursor.json`, which holds the run numbers
|
||||
already pushed. On the host it sits in the service's state directory. In the
|
||||
cluster it sits in the PersistentVolumeClaim `swarm-ci-metrics-state`, mounted
|
||||
at the same path, and the claim binds with the first Job. A switch copies
|
||||
neither, so each side keeps the cursor it last had, and the first pass on a side
|
||||
with none pushes every run again, as the same points. The pod starts on the
|
||||
empty claim with no gate. A second Job on the same side finds the cursor and
|
||||
pushes nothing. The claim stays after a switch back, and so does the host's
|
||||
directory.
|
||||
with none pushes every run again, as the same points. A second Job on the same
|
||||
side finds the cursor and pushes nothing. The claim stays after a switch back,
|
||||
and so does the host's directory.
|
||||
|
||||
## The controller
|
||||
|
||||
|
|
@ -192,13 +173,13 @@ controller may move there.
|
|||
`/healthz` and readiness on `/readyz`. Readiness needs the queue connection
|
||||
and a fresh store login, so a store role that refuses the pod's token leaves
|
||||
it NotReady.
|
||||
- **State.** `/var/lib/swarm-controller` is the PersistentVolumeClaim
|
||||
`swarm-controller-state`. It starts empty, and nothing here copies the host's
|
||||
directory into it ([migrate](migrate.md) does). An empty claim holds no
|
||||
`operator-matrix-admins.json`, which reads as an empty set: the controller
|
||||
revokes nobody, and an account removed from the operator group before the
|
||||
copy keeps its homeserver admin. The webhook secret is in the store, so it
|
||||
survives.
|
||||
- **State.** `/var/lib/swarm-controller` is an `emptyDir`. The record of the
|
||||
operator Matrix admin grants is in the queue's key-value store, so the pod
|
||||
revokes the accounts the host controller granted. What the directory holds
|
||||
starts again from nothing: the forge avatar markers and the legacy webhook
|
||||
secret, which the secret store also holds. The controller's first start on
|
||||
the host imports a legacy grant file into the store, so run it there once
|
||||
before the switch.
|
||||
- **The rev.** The unit's rev file, `/etc/hyperhive/swarm-controller.json`, is a
|
||||
`subPath` mount of the `swarm-controller-etc` ConfigMap, which a running pod
|
||||
never sees change. The Deployment's pod template carries `checksum/etc`, a
|
||||
|
|
|
|||
Loading…
Reference in a new issue