Watch
0
0
Fork
You've already forked hyperhive
0

docs: the review classifier and the claude login minter run in the cluster with deploy.<service>.runtime

This commit is contained in:
atlas 2026-11-22 02:44:25 +01:00 • committed by maia
commit c640a89aa0
3 changed files with 96 additions and 39 deletions

View file

@ -36,10 +36,10 @@ Each of these is a flake package named `image-<daemon>`, and the image name is
- `swarm-ci-metrics`
`nix flake check` evaluates all six and builds none of them, so the workspace
compile stays out of CI. `swarm-claude-login` and `swarm-review-classifier`
need claude-code in their image and aren't in the set yet. `swarm-stt` isn't
in the set either: [the manifest renderer](manifests.md#pods) builds its image,
with the ffmpeg, whisper-cli and model paths its unit's environment names.
compile stays out of CI. `swarm-claude-login`, `swarm-review-classifier` and
`swarm-stt` aren't in the set: [the manifest renderer](manifests.md#pods) builds
their images, with the paths their units' environments name (claude-code and
opencode, ffmpeg, whisper-cli and the model).
## Tags

View file

@ -19,16 +19,17 @@ to the cluster, when the service's `runtime` says `"k8s"`.
A service gets manifests on the host whose configuration deploys it:
| service | workload | other objects |
| --------------------- | ---------- | ------------------------------------------------------------------------------------------------ |
| `swarm-controller` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-controller-state`, ConfigMap `swarm-controller-etc` |
| `swarm-notify-router` | Deployment | ServiceAccount |
| `swarm-stt` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-stt-state` |
| `swarm-ci-metrics` | CronJob | ServiceAccount, PersistentVolumeClaim `swarm-ci-metrics-state` |
| service | workload | other objects |
| ------------------------- | ---------- | ------------------------------------------------------------------------------------------------ |
| `swarm-controller` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-controller-state`, ConfigMap `swarm-controller-etc` |
| `swarm-notify-router` | Deployment | ServiceAccount |
| `swarm-stt` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-stt-state` |
| `swarm-review-classifier` | Deployment | ServiceAccount |
| `swarm-claude-login` | Deployment | ServiceAccount |
| `swarm-ci-metrics` | CronJob | ServiceAccount, PersistentVolumeClaim `swarm-ci-metrics-state` |
`namespace.yaml` holds the Namespace. NATS with its auth responder,
`swarm-review-classifier` and `swarm-claude-login` have no manifests yet: their
images don't exist yet.
`namespace.yaml` holds the Namespace. NATS with its auth responder has no
manifests yet: its image doesn't exist yet.
## One source: the unit

View file

@ -5,18 +5,20 @@ 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,
or two cursors that push every CI run twice. `swarm-notify-router`, `swarm-stt`
and `swarm-ci-metrics` have the option today, and the other services that run
in the cluster follow the same pattern.
or two cursors that push every CI run twice. `swarm-notify-router`,
`swarm-stt`, `swarm-ci-metrics`, `swarm-review-classifier` and
`swarm-claude-login` 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.
- `services.hyperhive.deploy.ci-metrics.runtime` (default `"host"`), with the
- `services.hyperhive.deploy.stt.runtime`,
`services.hyperhive.deploy.ci-metrics.runtime`,
`services.hyperhive.deploy.review-classifier.runtime` and
`services.hyperhive.deploy.claude-login.runtime` (default `"host"`), with the
same rule.
With `"host"`, a host without [the cluster node](node.md) renders the same
@ -26,9 +28,10 @@ on `"host"`, the cluster holds no service objects.
## What `"k8s"` changes
- **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. `swarm-ci-metrics` has no container: its service,
its timer and the CA bundle unit of its service go.
(`swarm-notify-router`, `swarm-stt`, `swarm-review-classifier`,
`swarm-claude-login`), no credential hand-ins for it and no journal forwarder
for it. `swarm-ci-metrics` has no container: its service, its timer and the
CA bundle unit of its service go.
- **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
@ -130,25 +133,63 @@ file is the store's CA, `bao-ca.pem`, which comes from the `hyperhive-ca-trust`
ConfigMap. The pod has no Secret volume, and no `swarm-ci-metrics-credentials`
Secret exists, because nothing creates it.
## The claude daemons
`swarm-review-classifier` and `swarm-claude-login` keep no state, so a switch
moves nothing and the renderer adds no volume. Their units set no limits, so their
pods have none. Both run `claude`, which the daemon starts with `HOME` set to a
scratch directory under the system's temporary directory (the classifier also
starts `opencode` that way). The pod's root filesystem takes no writes, and its
`/tmp` is an `emptyDir` volume, so each scratch directory, and the config
`claude` writes under it, land in that volume and go with the pod. The
claude login minter writes the credentials it gets to the secret store, not to
disk. The image holds `claude-code` (and `opencode` for the classifier) from the
store paths the unit's environment names, the same ones the container uses. The
unit's own configuration allows the unfree `claude-code`, so the host needs no
global allowance.
Both log in to the store with their ServiceAccount token through a jwt role
that has the policy of their certificate role. The minter's role writes the
agents' `claude-credentials` leaves, as its certificate does.
Neither side restricts the network. The review classifier runs a model-driven
agent over untrusted PR text, and its ACP runtime takes its `base_url` from the
run, so the hosts it reaches aren't fixed. In a pod it has the security shape
every pod has (above) in place of its unit's `DynamicUser` and `PrivateTmp`. A
tighter sandbox and an egress policy belong to the network policy work.
Both pods push their telemetry to the hive collector, as the router and
`swarm-stt` do, because the loopback forwarder their units name has no
counterpart in a pod. The hive collector stamps the `hive` label on what it
forwards.
## Validation
`module-eval-k8s` checks that the host render with `"host"` holds the 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
unit are as the module defines them, and likewise for the review classifier and the claude
login minter. 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, and that the poller's pod keeps
the swarm route its unit names, where every other pod gets the hive collector,
and mounts no Secret. The VM test `k8s-runtime-switch`
runs a router, the speech-to-text service and the CI run poller against the
real secret store and a queue. It switches all three 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, requests nothing and is Burstable, and has its cache volume bound.
For `swarm-ci-metrics` it asserts that the host has no timer or service on the
and mounts no Secret. The VM test `k8s-runtime-switch` runs a router, the
speech-to-text service, the CI run poller, the review classifier and the claude
login minter against the real secret store and a queue. It switches all five
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, requests
nothing and is Burstable, and has its cache volume bound. For
`swarm-ci-metrics` it asserts that the host has no timer or service on the
cluster side, and that the cluster has no CronJob, Job or pod on the host side
before the timer starts. A Job completes against a forge stub that lists one
run and pushes it to the poller's own route with a bearer the identity
provider stub minted. The pod holds no Secret and binds its cursor volume, and
a second Job, and a Job after a round trip through the host, push nothing. The
host's own pass against the same stubs is the control.
before the timer starts. A Job completes against a forge stub that lists one run
and pushes it to the poller's own route with a bearer the identity provider
stub minted. The pod holds no Secret and binds its cursor volume, and a second
Job, and a Job after a round trip through the host, push nothing. The host's
own pass against the same stubs is the control. For the two claude daemons it
asserts that each pod is Ready and logged in with its token, that the minter's
token writes an agent's credentials and the classifier's token can't, that the
pod's root takes no writes, so a write outside the `/tmp` volume fails, and
that `claude` with `HOME` in the volume writes its config there, as the
minter's real login step does, while `claude` with `HOME` on the root leaves
nothing there.