k8s: stt and ci-metrics start without a state gate
This commit is contained in:
parent
d6d30df90b
commit
6ac4e9b87d
1 changed files with 296 additions and 309 deletions
|
|
@ -80,15 +80,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 | 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 |
|
||||
| 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 | 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 |
|
||||
|
||||
Two facts the table rests on:
|
||||
|
||||
|
|
@ -108,18 +108,16 @@ Two facts the table rests on:
|
|||
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.
|
||||
2. **`swarm-review-classifier`, `swarm-claude-login`, `swarm-stt`**, in one
|
||||
rebuild or one at a time. No state, same pattern as step 1.
|
||||
3. **`swarm-ci-metrics`.** The first copy, of one small file. It exercises
|
||||
the snapshot, the gate, the copy and the rollback on state whose loss
|
||||
costs a re-push, not data.
|
||||
4. **NATS with `swarm-nats-auth`.** The riskiest move: the largest copy, every
|
||||
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: the largest copy, every
|
||||
hive and agent disconnects, and the data is the swarm's desired state.
|
||||
The copy path has run once by then. `swarm-nats-auth` moves in the same
|
||||
pod, because it answers the auth callout on every connect and dials the
|
||||
It's the first copy `swarmctl migrate` makes. `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.
|
||||
5. **`swarm-controller` last.**
|
||||
- It's the operator's view of the swarm. Kept on the host through step 4,
|
||||
4. **`swarm-controller` last.**
|
||||
- It's the operator's view of the swarm. Kept on the host through step 3,
|
||||
it reports from an unchanged place whether the hives reconnected after
|
||||
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
|
||||
|
|
@ -214,9 +212,7 @@ 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. A
|
||||
service with state that moves nothing, `swarm-stt`, still needs the marker:
|
||||
`swarmctl migrate` writes one that names no source.
|
||||
(`{"fresh": true, "at": <time>}`), and `swarmctl migrate` isn't needed.
|
||||
|
||||
## Downtime and what hives see
|
||||
|
||||
|
|
@ -229,7 +225,7 @@ pod passing step 4.
|
|||
| `swarm-review-classifier` | 2 min | A try-out request in the gap gets no answer, and its caller reports a failure |
|
||||
| `swarm-claude-login` | 2 min | A login in progress fails; the operator starts it again |
|
||||
| `swarm-stt` | 2 min | Transcription requests fail during the gap; the cache starts empty |
|
||||
| `swarm-ci-metrics` | one 5-minute period | One pass runs late; the copied cursor means no run gets pushed twice |
|
||||
| `swarm-ci-metrics` | one 5-minute period | One pass runs late; the first pass on the pod's empty cursor pushes every run again |
|
||||
| NATS + `swarm-nats-auth` | 10 min; the copy takes most of it | below |
|
||||
| `swarm-controller` | 5 min | The swarm UI and API answer with gateway errors. Forge webhook deliveries in the gap fail at the forge. After the cut-over, `swarmctl` on the host needs `--swarm` |
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue