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
|
### Review classifier
|
||||||
|
|
||||||
The review classifier's try-out service, in a `swarm-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
|
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
|
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
|
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
|
### Claude login minter
|
||||||
|
|
||||||
The claude login minter, in a `swarm-claude-login` container on the host that
|
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
|
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
|
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:
|
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`
|
- `swarm-ci-metrics`
|
||||||
|
|
||||||
`nix flake check` evaluates all six and builds none of them, so the workspace
|
`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`
|
compile stays out of CI. `swarm-claude-login`, `swarm-review-classifier` and
|
||||||
need claude-code in their image and aren't in the set yet. `swarm-stt` isn't
|
`swarm-stt` aren't in the set: [the manifest renderer](manifests.md#pods) builds
|
||||||
in the set either: [the manifest renderer](manifests.md#pods) builds its image,
|
their images, with the paths their units' environments name (claude-code and
|
||||||
with the ffmpeg, whisper-cli and model paths its unit's environment names.
|
opencode, ffmpeg, whisper-cli and the model).
|
||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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:
|
A service gets manifests on the host whose configuration deploys it:
|
||||||
|
|
||||||
| service | workload | other objects |
|
| service | workload | other objects |
|
||||||
| --------------------- | ---------- | ------------------------------------------------------------------------------------------------ |
|
| ------------------------- | ---------- | ------------------------------------------------------------------------------------------------ |
|
||||||
| `swarm-controller` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-controller-state`, ConfigMap `swarm-controller-etc` |
|
| `swarm-controller` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-controller-state`, ConfigMap `swarm-controller-etc` |
|
||||||
| `swarm-notify-router` | Deployment | ServiceAccount |
|
| `swarm-notify-router` | Deployment | ServiceAccount |
|
||||||
| `swarm-stt` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-stt-state` |
|
| `swarm-stt` | Deployment | ServiceAccount, PersistentVolumeClaim `swarm-stt-state` |
|
||||||
| `swarm-ci-metrics` | CronJob | ServiceAccount, PersistentVolumeClaim `swarm-ci-metrics-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,
|
`namespace.yaml` holds the Namespace. NATS with its auth responder has no
|
||||||
`swarm-review-classifier` and `swarm-claude-login` have no manifests yet: their
|
manifests yet: its image doesn't exist yet.
|
||||||
images don't exist yet.
|
|
||||||
|
|
||||||
## One source: the unit
|
## 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
|
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
|
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,
|
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`
|
or two cursors that push every CI run twice. `swarm-notify-router`,
|
||||||
and `swarm-ci-metrics` have the option today, and the other services that run
|
`swarm-stt`, `swarm-ci-metrics`, `swarm-review-classifier` and
|
||||||
in the cluster follow the same pattern.
|
`swarm-claude-login` have the option today, and the other services that run in
|
||||||
|
the cluster follow the same pattern.
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
- `services.hyperhive.deploy.notify-router.runtime` (default `"host"`).
|
- `services.hyperhive.deploy.notify-router.runtime` (default `"host"`).
|
||||||
`"k8s"` needs `services.hyperhive.deploy.k8s.enable` on the same host, and the
|
`"k8s"` needs `services.hyperhive.deploy.k8s.enable` on the same host, and the
|
||||||
evaluation fails without it.
|
evaluation fails without it.
|
||||||
- `services.hyperhive.deploy.stt.runtime` (default `"host"`), with the same
|
- `services.hyperhive.deploy.stt.runtime`,
|
||||||
rule.
|
`services.hyperhive.deploy.ci-metrics.runtime`,
|
||||||
- `services.hyperhive.deploy.ci-metrics.runtime` (default `"host"`), with the
|
`services.hyperhive.deploy.review-classifier.runtime` and
|
||||||
|
`services.hyperhive.deploy.claude-login.runtime` (default `"host"`), with the
|
||||||
same rule.
|
same rule.
|
||||||
|
|
||||||
With `"host"`, a host without [the cluster node](node.md) renders the same
|
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
|
## What `"k8s"` changes
|
||||||
|
|
||||||
- **The host unit goes.** The configuration has no container for the service
|
- **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
|
(`swarm-notify-router`, `swarm-stt`, `swarm-review-classifier`,
|
||||||
journal forwarder for it. `swarm-ci-metrics` has no container: its service,
|
`swarm-claude-login`), no credential hand-ins for it and no journal forwarder
|
||||||
its timer and the CA bundle unit of its service go.
|
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 service's objects go in.** The [rendered manifests](manifests.md) reach
|
||||||
the cluster through `services.k3s.manifests`, one file per service plus the
|
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
|
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`
|
ConfigMap. The pod has no Secret volume, and no `swarm-ci-metrics-credentials`
|
||||||
Secret exists, because nothing creates it.
|
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
|
## Validation
|
||||||
|
|
||||||
`module-eval-k8s` checks that the host render with `"host"` holds the container,
|
`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
|
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
|
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
|
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,
|
the swarm route its unit names, where every other pod gets the hive collector,
|
||||||
and mounts no Secret. The VM test `k8s-runtime-switch`
|
and mounts no Secret. The VM test `k8s-runtime-switch` runs a router, the
|
||||||
runs a router, the speech-to-text service and the CI run poller against the
|
speech-to-text service, the CI run poller, the review classifier and the claude
|
||||||
real secret store and a queue. It switches all three from the host to the
|
login minter against the real secret store and a queue. It switches all five
|
||||||
cluster and back, checks each step for exactly one copy of each, and asserts
|
from the host to the cluster and back, checks each step for exactly one copy of
|
||||||
that the router's pod logs in, routes an event, and exits 0 when deleted. For `swarm-stt` it asserts that the
|
each, and asserts that the router's pod logs in, routes an event, and exits 0
|
||||||
pod is Ready, logged in to the store with its ServiceAccount token, carries the
|
when deleted. For `swarm-stt` it asserts that the pod is Ready, logged in to
|
||||||
unit's limits, requests nothing and is Burstable, and has its cache volume bound.
|
the store with its ServiceAccount token, carries the unit's limits, requests
|
||||||
For `swarm-ci-metrics` it asserts that the host has no timer or service on the
|
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
|
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
|
before the timer starts. A Job completes against a forge stub that lists one run
|
||||||
run and pushes it to the poller's own route with a bearer the identity
|
and pushes it to the poller's own route with a bearer the identity provider
|
||||||
provider stub minted. The pod holds no Secret and binds its cursor volume, and
|
stub minted. The pod holds no Secret and binds its cursor volume, and a second
|
||||||
a second Job, and a Job after a round trip through the host, push nothing. The
|
Job, and a Job after a round trip through the host, push nothing. The host's
|
||||||
host's own pass against the same stubs is the control.
|
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
|
Run one: a login in progress lives in the service's memory between its start
|
||||||
and its code.
|
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
|
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,
|
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
|
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
|
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.
|
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
|
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
|
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
|
chosen runtime and shows whether one exists and when it changed, never the
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue