Watch
0
0
Fork
You've already forked hyperhive
0

docs: the speech-to-text service's runtime, limits and cache volume

This commit is contained in:
atlas 2026-11-21 23:19:32 +01:00 • committed by maia
commit f0573125fb

View file

@ -5,14 +5,16 @@ unit, or as a pod in the host's cluster. `services.hyperhive.deploy.<service>.ru
is `"host"` (the default) or `"k8s"`. The service runs once per swarm, so the
option moves it and never copies it: the host unit and the pod never run
together, because they would share one queue consumer and one set of buckets.
`swarm-notify-router` has the option today, and the other services that run in
the cluster follow the same pattern.
`swarm-notify-router` and `swarm-stt` have the option today, and the other
services that run in the cluster follow the same pattern.
## Options
- `services.hyperhive.deploy.notify-router.runtime` (default `"host"`).
`"k8s"` needs `services.hyperhive.deploy.k8s.enable` on the same host, and the
evaluation fails without it.
- `services.hyperhive.deploy.stt.runtime` (default `"host"`), with the same
rule.
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
@ -20,8 +22,9 @@ on `"host"`, the cluster holds no service objects.
## What `"k8s"` changes
- **The host unit goes.** The configuration has no `swarm-notify-router`
container, no credential hand-ins for it and no journal forwarder for it.
- **The host unit goes.** The configuration has no container for the service
(`swarm-notify-router`, `swarm-stt`), no credential hand-ins for it and no
journal forwarder for it.
- **The service's objects go in.** The [rendered manifests](manifests.md) reach
the cluster through `services.k3s.manifests`, one file per service plus the
namespace. The cluster applies a file when its link appears in the manifests
@ -77,12 +80,38 @@ forge events stream and its `notify-router-state` bucket live in the queue, so a
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
the PersistentVolumeClaim `swarm-stt-state`, mounted at the same path. A switch
copies neither: each side starts with the cache it last had, empty the first
time, and transcribes a memo that only the other side cached. The claim stays
after a switch back, as every claim does, and the container's directory stays
too. The whisper model isn't state: the pod's image holds it, from the same
store path the container reads, and the volume doesn't.
## Resources and sandbox
The pod takes the unit's `MemoryMax` and `CPUQuota` as its container's limits
([manifests](manifests.md#pods)), so `swarm-stt` keeps its 3 GiB and four-core
ceilings. The pod has no `requests`, so Kubernetes reserves those limits on the
node: the node needs that memory and those cores free to schedule the pod.
`TasksMax` has no pod counterpart, so the renderer drops it. The systemd sandbox
(`MemoryDenyWriteExecute`, `SystemCallFilter`, `PrivateUsers`, the read-only
`ProtectSystem` and the rest) stays on the host. The pod is a non-root user with
a read-only root filesystem, every capability dropped, the runtime's default
seccomp profile and no API token, which is its whole sandbox. Neither side
restricts the network.
## Validation
`module-eval-k8s` checks that the host render with `"host"` holds the container,
no cluster manifests and no CA objects. With `"k8s"` it checks that no container
no cluster manifests and no CA objects, and that `swarm-stt`'s container and
unit are as the module defines them. With `"k8s"` it checks that no container
remains, that the manifests sit in `services.k3s.manifests`, and that the
evaluation refuses `"k8s"` without the node. The VM test `k8s-runtime-switch`
runs a router against the real secret store and a queue. It switches from the
host to the cluster and back, checks each step for exactly one copy, and asserts
that the pod logs in, routes an event, and exits 0 when deleted.
runs a router and the speech-to-text service against the real secret store and
a queue. It switches both from the host to the cluster and back, checks each
step for exactly one copy of each, and asserts that the router's pod logs in,
routes an event, and exits 0 when deleted. For `swarm-stt` it asserts that the
pod is Ready, logged in to the store with its ServiceAccount token, carries the
unit's limits, and has its cache volume bound.