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 89308e8ba5

View file

@ -47,6 +47,44 @@ cluster when its `runtime` is `"k8s"` ([the runtime switch](runtime.md)).
With the option off, the host's configuration is the one it has without the
module.
## Node labels
A service whose data sits on one node's disk runs on that node, and the node
says so with a label. The module sets the labels
(`services.hyperhive.deploy.k8s.nodeLabels`, passed to `services.k3s.nodeLabel`):
- `hyperhive.darkest.space/state-<service>=true`, one per service whose data
the cluster keeps. Today that's `nats`, when `deploy.nats.runtime` is
`"k8s"`, and `ci-metrics`, when `deploy.ci-metrics.runtime` is `"k8s"`. The
service's static local volume has a `nodeAffinity` on the label, and its pod a
`nodeSelector` on it, so a node without the label can't run the pod and shows
as no match instead of a volume that can't bind. One label per service, so
moving one service's data moves one label.
- `hyperhive.darkest.space/entry=true`, on the node the hosts' DNS points at.
Nothing selects on it yet. The pods that hosts dial will, as they move in.
- `svccontroller.k3s.cattle.io/enablelb=true`. With this label on any node, k3s's
service load balancer binds a published port on the labelled nodes only
(k3s documents it under "Controlling servicelb node selection"). Without it, a
node that joins would also bind the queue's port 4222.
On the single node, every label is on the node and the pods are the ones the
node ran without them, plus a `nodeSelector`. **A node that joins carries
none of the labels**, so it can't run a pod that keeps data on a disk, and
the load balancer doesn't bind the queue's port on it. A stateless pod can run
there.
k3s applies `--node-label` to the node's object at every start, whether the
node registered before or not, so a node that registered before a label existed
has the label after the restart a switch causes. A pod that selects on a label
the node doesn't have yet waits as Pending and starts when the label arrives.
k3s only adds labels. A label the module no longer sets, such as `state-nats`
after the queue moves back to `"host"`, stays on the node and does nothing,
because no pod selects on it. `kubectl label node <name> <label>-` removes it.
Moving a service's data to another node is manual: copy the directory, put the
label on the new node, take it off the old one. Moving it with a command
belongs to a later version.
## Reaching host-run services
A pod reaches a service that runs on the host by the service's swarm name. The