docs: the review classifier and the claude login minter run in the cluster with deploy.<service>.runtime
This commit is contained in:
parent
931ce8c016
commit
c640a89aa0
6 changed files with 96 additions and 39 deletions
|
|
@ -223,7 +223,8 @@ the metrics store. What it reads and pushes:
|
|||
### Review classifier
|
||||
|
||||
The review classifier's try-out service, in a `swarm-review-classifier`
|
||||
container on the host that sets `deploy.review-classifier.enable`. You set the
|
||||
container on the host that sets `deploy.review-classifier.enable`, or as a pod in the
|
||||
host's cluster with `deploy.review-classifier.runtime = "k8s"`. You set the
|
||||
key for the runtime the swarm settings choose in the swarm UI: the **classifier
|
||||
settings** card on `/jobs` takes a key for that runtime and shows whether one
|
||||
exists and when it changed, never the key. "Set" means a key exists, not that it
|
||||
|
|
@ -237,7 +238,8 @@ The store paths for the two keys, and what a run is and costs:
|
|||
### Claude login minter
|
||||
|
||||
The claude login minter, in a `swarm-claude-login` container on the host that
|
||||
sets `deploy.claude-login.enable`. Run one: a login in progress lives in the
|
||||
sets `deploy.claude-login.enable`, or as a pod in the host's cluster with
|
||||
`deploy.claude-login.runtime = "k8s"`. Run one: a login in progress lives in the
|
||||
service's memory between its start and its code. An operator logs an agent in
|
||||
from the **log in** button on its card in the swarm UI, and the agent's
|
||||
harness installs the new login. The flow and the version rule:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -20,15 +20,16 @@ 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-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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -127,6 +127,13 @@ the host has the minter's store identity, like the other swarm services.
|
|||
Run one: a login in progress lives in the service's memory between its start
|
||||
and its code.
|
||||
|
||||
With `deploy.claude-login.runtime = "k8s"` it runs as a pod in the host's
|
||||
cluster instead, and the host has no container. Each login's scratch directory
|
||||
is in the pod's `/tmp` volume, which is where `claude` writes its config, and
|
||||
the pod's store login can write the agents' credentials as the container's
|
||||
certificate does. Nothing moves in a switch: a login in progress ends, as it does
|
||||
on a restart. See [the runtime switch](../k8s/runtime.md#the-claude-daemons).
|
||||
|
||||
An operator logs an agent in from the **log in** button on its card in the
|
||||
swarm UI. swarm-controller relays the start and the pasted code over the queue,
|
||||
the minter runs `claude auth login` and writes the credentials to the agent's
|
||||
|
|
|
|||
|
|
@ -783,6 +783,12 @@ identity: the host that runs the store has it, and a services host with the
|
|||
store elsewhere gets the classifier only once it holds a copy of the pair (see
|
||||
below). Set `deploy.review-classifier.enable` directly to override either way.
|
||||
|
||||
With `deploy.review-classifier.runtime = "k8s"` it runs as a pod in the host's
|
||||
cluster instead, and the host has no container. Each run's scratch directory
|
||||
and its `HOME` are in the pod's `/tmp` volume. The pod's network isn't
|
||||
restricted, and the ACP runtime's `base_url` comes from the run. See
|
||||
[the runtime switch](../k8s/runtime.md#the-claude-daemons).
|
||||
|
||||
The operator sets the key of the runtime the swarm settings choose in the
|
||||
swarm UI: the **classifier settings** card on `/jobs` takes a key for the
|
||||
chosen runtime and shows whether one exists and when it changed, never the
|
||||
|
|
|
|||
Loading…
Reference in a new issue