Watch
0
0
Fork
You've already forked hyperhive
0

pin queue and poller state to per-service node labels instead of the hostname

This commit is contained in:
atlas 2026-11-25 21:48:02 +01:00 • committed by maia
commit ff2bdea78d

View file

@ -136,13 +136,22 @@ 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. 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.
already pushed. On the host it sits in the service's state directory,
`/var/lib/private/swarm-ci-metrics`. In the cluster it sits in the
PersistentVolumeClaim `swarm-ci-metrics-store`, mounted at the same path, which
binds a static local volume on that host directory. A switch moves the process
and not the cursor. The volume's `nodeAffinity` and the pod's `nodeSelector`
both name the node label `hyperhive.darkest.space/state-ci-metrics`
([node labels](node.md#node-labels)). The module makes the directory on a host
that never ran the service, because the volume needs it before the first Job.
The claim and its volume stay after a switch back, with the directory.
A host that ran the poller in the cluster before the volume was static has the
claim `swarm-ci-metrics-state` on the cluster's default class. A bound claim's
class can't change, so the poller uses a new claim and the old one stays,
unused, until the operator deletes it. The first Job after the upgrade finds
the host directory's cursor, or none, and pushes every run again as the same
points.
## The controller
@ -291,8 +300,11 @@ holds the container back until the pod has gone.
so a switch moves the process and not the bytes, and the pod has no state
gate. The container's unit runs `chown -R nats:nats` on the directory before
the server starts, and the pod's `fsGroup` gives its group read and write.
The volume is `local`, pinned to the node, with a storage class of its own
and the `Retain` policy, and the claim binds it by name.
The volume is `local`, with a storage class of its own and the `Retain`
policy, and the claim binds it by name. Its `nodeAffinity` and the pod's
`nodeSelector` both name the node label
`hyperhive.darkest.space/state-nats`, so the pod and the directory stay on the
node that carries it ([node labels](node.md#node-labels)).
The prune unit stops a pod before the container starts, and the Deployment
replaces its pod rather than running two, so one server reads the directory
at a time.