require k8s: swarm services with a pod run in the cluster only
This commit is contained in:
parent
6be1b59ffc
commit
052b559196
1 changed files with 1044 additions and 3125 deletions
|
|
@ -1,78 +1,90 @@
|
|||
# Where a service runs: the runtime switch
|
||||
# Where a service runs: the cluster
|
||||
|
||||
A swarm service with a `runtime` option runs in one of two places: as its host
|
||||
unit, or as a pod in the host's cluster. `services.hyperhive.deploy.<service>.runtime`
|
||||
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`, `swarm-ci-metrics`, `swarm-review-classifier`,
|
||||
The swarm services that have a pod run in the host's cluster and nowhere else:
|
||||
`swarm-notify-router`, `swarm-stt`, `swarm-ci-metrics`, `swarm-review-classifier`,
|
||||
`swarm-claude-login`, `swarm-controller` and the queue with its auth callout
|
||||
(`swarm-nats`) have the option today, and the other services that run in the
|
||||
cluster follow the same pattern.
|
||||
(`swarm-nats`). Each runs once per swarm, because two copies would share one
|
||||
queue consumer and one set of buckets, or two cursors that push every CI run
|
||||
twice. A host that enables one gets [the cluster node](node.md) with it: no
|
||||
option moves a service between the host and the cluster, and the host has no
|
||||
unit or container to move it back to. The secret store, the forge, authelia, the
|
||||
gateway, `swarm-builder`, `swarm-matrix-ctl` and every hive stay on the host.
|
||||
|
||||
## Moving a service
|
||||
## The node comes with the services
|
||||
|
||||
To move a service into the cluster, set its `runtime` to `"k8s"` and rebuild.
|
||||
To move it back, set `runtime` back to `"host"` and rebuild.
|
||||
No command copies data, and a move loses nothing a service holds.
|
||||
The queue keeps its host store: the pod mounts the directory the container's unit uses, so a switch moves the process and not the bytes.
|
||||
The controller and the other services hold nothing a move loses; [State](#state) lists what each one keeps.
|
||||
Hives and agents keep the queue's URL, port, certificate name and auth callout, so no hive needs a rebuild.
|
||||
The secret store, the forge, authelia, the gateway, `swarm-builder`, `swarm-matrix-ctl` and every hive stay on the host.
|
||||
`services.hyperhive.deploy.k8s.enable` defaults on where the host enables any
|
||||
of `deploy.notify-router`, `stt`, `ci-metrics`, `review-classifier`,
|
||||
`claude-login`, `nats` or `swarm-controller`. `deploy.singleHostSwarm` and
|
||||
`deploy.allSwarmServices` enable them, so an all-local host gets the node and
|
||||
every service in the cluster with no further option. A host that sets
|
||||
`deploy.k8s.enable = false` while it enables one fails at evaluation, and the
|
||||
message names the option and the services.
|
||||
|
||||
## Options
|
||||
Some services need more of the host, and the evaluation names the option each
|
||||
time it's missing:
|
||||
|
||||
- `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`,
|
||||
`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.
|
||||
- `services.hyperhive.deploy.swarm-controller.runtime` (default `"host"`), with
|
||||
the same rule. It also needs
|
||||
`services.hyperhive.swarm.controller.tcp.enable`, and
|
||||
`deploy.swarm-controller.tcp.listenAddress` at its default `0.0.0.0`: the
|
||||
evaluation fails without either. [The controller](#the-controller) has its
|
||||
own section.
|
||||
- `services.hyperhive.deploy.nats.runtime` (default `"host"`), with the same
|
||||
rule. One switch covers the queue's server and its auth callout. It needs
|
||||
the iptables firewall (`networking.nftables.enable` off).
|
||||
[The queue](#the-queue) has its own section.
|
||||
- `swarm-controller` needs `services.hyperhive.swarm.domain`, which names its
|
||||
TLS listener (`swarm.controller.tcp.domain`, `controller.<swarm.domain>` by
|
||||
default) and turns the listener on (`swarm.controller.tcp.enable`, on by
|
||||
default): the host can't reach a unix socket inside a pod, so the gateway dials
|
||||
the listener. A setting that can't work fails the evaluation: the listener off,
|
||||
`deploy.swarm-controller.tcp.listenAddress` other than its default `0.0.0.0` (the
|
||||
bind inside the pod), or `services.hyperhive.gateway.dns.enable` off, because the
|
||||
hive's resolver hands the cluster's domain to CoreDNS.
|
||||
- `nats` needs `services.hyperhive.gateway.dns.enable` too, and the iptables
|
||||
firewall (`networking.nftables.enable` off).
|
||||
|
||||
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
|
||||
on `"host"`, the cluster holds no service objects.
|
||||
## Upgrading
|
||||
|
||||
## What `"k8s"` changes
|
||||
An upgrade from a host that ran a service as its host unit or container is one
|
||||
`nixos-rebuild switch`, with nothing to do beforehand and no copy of data.
|
||||
|
||||
- **The host unit goes.** The configuration has no container for the service
|
||||
(`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. `swarm-controller` has no container
|
||||
either: the host turns `swarm-controller.service` off, so nothing can start
|
||||
it, and defines no `swarm-controller-tls.service` or timer. The evaluated
|
||||
unit stays the source of the Deployment.
|
||||
- **The service's objects go in.** The [rendered manifests](manifests.md) reach
|
||||
the cluster through `services.k3s.manifests`, one file per service plus the
|
||||
`switch-to-configuration` stops every unit the new configuration drops, and waits
|
||||
for each stop, before it runs the activation that links the manifests into the
|
||||
cluster's manifests directory (`switch-to-configuration-ng`'s `main.rs` sends the stop jobs for the removed
|
||||
units, waits for them, and then runs the activation script). The cluster applies a manifest when its
|
||||
link appears, so the old copy of each service has stopped before its pod can start.
|
||||
A removed container is a drop-in of the `container@` template, which the same
|
||||
code treats as removed when no drop-in remains. Nothing else keeps the copies
|
||||
apart.
|
||||
|
||||
The data stays where it was:
|
||||
|
||||
- The queue's pod mounts `/var/lib/nixos-containers/swarm-nats/var/lib/nats`, the
|
||||
directory the container's server used, as a static local volume
|
||||
([State](#state)).
|
||||
- The poller's cursor is `/var/lib/private/swarm-ci-metrics`, mounted the same
|
||||
way.
|
||||
- The other services keep nothing a move has to carry.
|
||||
|
||||
The pods log in to the store with their ServiceAccount tokens, so the store's
|
||||
`jwt-k8s` auth mount has to be there before they can. The first switch that turns
|
||||
the node on restarts the store, so [unseal it](node.md) before the pods log in.
|
||||
|
||||
No way back to the host unit exists: the options that chose it have gone, and so
|
||||
have the units. To leave the cluster, switch to an older generation.
|
||||
|
||||
## What the cluster runs
|
||||
|
||||
- **The service's objects.** 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
|
||||
directory.
|
||||
- **The pod reads the unit the container ran.** The unit comes from the
|
||||
container's own configuration, evaluated on its own when the host has no
|
||||
container, so the pod's environment is the unit's environment either way.
|
||||
The poller has no container: the renderer evaluates its service and timer on
|
||||
their own when the host doesn't run them, and the CronJob follows that timer.
|
||||
- **The unit the pod comes from.** Each service module still defines the
|
||||
systemd unit, and the renderer reads the pod's environment, credential ids and
|
||||
limits from it. The host doesn't run the unit: the module evaluates it on its
|
||||
own for the services that had a container, and defines
|
||||
`swarm-controller.service` with `enable = false`. The module evaluates the
|
||||
poller's service and timer on their own too, and the CronJob follows the
|
||||
timer.
|
||||
- **The host publishes the CA files.** `hyperhive-k8s-ca-trust.service` applies
|
||||
the `hyperhive-ca-trust` ConfigMap from the host's files, with no manual step:
|
||||
- `trust-bundle.pem`: the hive's trust bundle, where the gateway is
|
||||
self-signed;
|
||||
- `bao-server-ca.pem`: the secret store's server CA
|
||||
(`deploy.bao.serverCaFile`);
|
||||
- `hive-client-ca.pem` and `swarm-services-root.pem`, with the controller in
|
||||
the cluster: the authority the controller writes into each hive's store role
|
||||
- `hive-client-ca.pem` and `swarm-services-root.pem`, for the controller: the
|
||||
authority the controller writes into each hive's store role
|
||||
(`deploy.swarm-controller.hiveClientCaFile`), and the store's services root
|
||||
that its listener trusts the gateway's client leaf by.
|
||||
|
||||
|
|
@ -83,68 +95,31 @@ on `"host"`, the cluster holds no service objects.
|
|||
trust bundle until it restarts, because the kubelet doesn't update `subPath`
|
||||
mounts.
|
||||
|
||||
## One copy at a time
|
||||
|
||||
`switch-to-configuration` stops every unit the new configuration drops, and waits
|
||||
for each stop, before it activates the new configuration. The activation links
|
||||
the manifests. Switching to `"k8s"` therefore stops the container before the
|
||||
cluster can apply the pod.
|
||||
|
||||
The cluster doesn't delete what a manifest created after the manifest goes away,
|
||||
and it keeps the file's link in its manifests directory. Switching back to
|
||||
`"host"` therefore needs a step of its own. `<service>-k8s-prune.service` belongs
|
||||
to every configuration that has the node and the service on `"host"`, and each
|
||||
of the service's host units requires it and starts after it. The poller has
|
||||
two, its timer and its service, so a pass started by hand can't run beside a
|
||||
Job:
|
||||
|
||||
1. If the manifest's link exists, rename it to `<service>.yaml.pruning`, so the
|
||||
cluster doesn't apply it again. The rename also records what remains to
|
||||
delete. With no link, nothing went in, so the unit does nothing and needs no
|
||||
cluster.
|
||||
2. Wait for the cluster's API, then delete the service's Deployment, CronJob,
|
||||
Service, NetworkPolicy and ServiceAccount (selected by
|
||||
`app.kubernetes.io/name`), and wait until its pods have gone. A pod exits 0
|
||||
within its termination grace period. Then wait until the pods that the
|
||||
service load balancer bound the service's Services' ports with, in
|
||||
`kube-system`, have gone too: the rule that forwards a port to one stays
|
||||
until the pod does.
|
||||
3. Delete the cluster's AddOn for the file, so that a later switch to `"k8s"`
|
||||
applies the same manifest again. Then remove the renamed link.
|
||||
|
||||
A failed step fails the unit, and the host unit doesn't start: the service stays
|
||||
down and never doubles. A rerun resumes from the renamed link. Persistent volume
|
||||
claims stay until the operator deletes them.
|
||||
|
||||
## State
|
||||
|
||||
No pod starts behind a gate that checks its state volume: a service keeps
|
||||
nothing a switch has to copy. Each service's state is below.
|
||||
nothing an upgrade has to copy. Each service's state is below.
|
||||
`swarm-notify-router`, `swarm-review-classifier` and `swarm-claude-login` have
|
||||
no volume.
|
||||
|
||||
`swarm-notify-router` keeps nothing on the host. Its durable consumer on the
|
||||
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.
|
||||
forge events stream and its `notify-router-state` bucket live in the queue, so an
|
||||
upgrade 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 an
|
||||
`emptyDir` at the same path, so the pod has no claim and starts on an empty
|
||||
cache on every start of the pod. A switch copies nothing, and the service
|
||||
transcribes a memo that only the other side cached. The whisper model isn't
|
||||
state: the pod's image holds it, from the same store path the container reads.
|
||||
`swarm-stt` keeps a transcript cache, which lives 24 hours. It sits in an `emptyDir` at `/var/lib/swarm-stt`, so the pod has no claim and
|
||||
starts on an empty cache on every start of the pod; an upgrade from the
|
||||
container doesn't carry the old cache over. The whisper model isn't state: the
|
||||
pod's image holds it.
|
||||
|
||||
`swarm-ci-metrics` keeps a cursor, `cursor.json`, which holds the run numbers
|
||||
already pushed. On the host it sits in the service's state directory,
|
||||
`/var/lib/private/swarm-ci-metrics`. In the cluster it sits in the
|
||||
PersistentVolumeClaim `swarm-ci-metrics-store`, mounted at the same path, which
|
||||
binds a static local volume on that host directory. A switch moves the process
|
||||
already pushed. It sits in the PersistentVolumeClaim `swarm-ci-metrics-store`, mounted at
|
||||
`/var/lib/private/swarm-ci-metrics`, which binds a static local volume on that
|
||||
host directory, the service's old state directory. An upgrade moves the process
|
||||
and not the cursor. The volume's `nodeAffinity` and the pod's `nodeSelector`
|
||||
both name the node label `hyperhive.darkest.space/state-ci-metrics`
|
||||
([node labels](node.md#node-labels)). The module makes the directory on a host
|
||||
that never ran the service, because the volume needs it before the first Job.
|
||||
The claim and its volume stay after a switch back, with the directory.
|
||||
The claim and its volume stay until the operator deletes them, with the directory.
|
||||
|
||||
A host that ran the poller in the cluster before the volume was static has the
|
||||
claim `swarm-ci-metrics-state` on the cluster's default class. A bound claim's
|
||||
|
|
@ -157,11 +132,10 @@ points.
|
|||
|
||||
`swarm-controller` runs once per swarm, and nothing in the daemon guards that: a
|
||||
second copy would send the operator admin grants and revokes again, split the
|
||||
review requests the queue holds, and write the same keys. The runtime switch is
|
||||
the whole guard on one node: the Deployment has one replica and the `Recreate`
|
||||
strategy, and the prune unit holds the host unit back until the pod has gone. No
|
||||
leader lock exists, so a cluster of more than one node needs one before the
|
||||
controller may move there.
|
||||
review requests the queue holds, and write the same keys. On one node the guard is
|
||||
the Deployment: one replica and the `Recreate` strategy, and the removed host
|
||||
unit stops before the pod can start. No leader lock exists, so a cluster
|
||||
of more than one node needs one before the controller may run there.
|
||||
|
||||
- **The gateway's hop.** The host can't reach a unix socket inside a pod, so
|
||||
the pod serves the TCP listener, and a ClusterIP Service,
|
||||
|
|
@ -183,8 +157,7 @@ controller may move there.
|
|||
pod does. A Service works on a cluster of more than one node, but the
|
||||
controller's Deployment still has the one replica.
|
||||
- **The listener's leaf.** The pod issues its own, from the store's
|
||||
`swarm-controller-tls` role, with the same script as
|
||||
`swarm-controller-tls.service`. An init container logs in with the pod's
|
||||
`swarm-controller-tls` role. An init container logs in with the pod's
|
||||
ServiceAccount token (the `swarm-controller` role of the `jwt-k8s` mount,
|
||||
whose policy holds the one issue path) and writes the leaf and its key into
|
||||
an `emptyDir` before the daemon starts. The `emptyDir` is in memory
|
||||
|
|
@ -199,7 +172,7 @@ controller may move there.
|
|||
- **`swarmctl`.** The controller's socket lives inside the pod, so the host's
|
||||
`swarmctl` reaches the controller only through the gateway: run
|
||||
`swarmctl login` once, then use `--swarm <url>` or a wrapper that defaults
|
||||
to it. A socket path on the host serves nothing under `runtime = "k8s"`.
|
||||
to it. A socket path on the host serves nothing.
|
||||
- **Probes.** The pod binds `SWARM_CONTROLLER_HEALTH_ADDR`, with liveness on
|
||||
`/healthz` and readiness on `/readyz`. Readiness needs the queue connection
|
||||
and a fresh store login, so a store role that refuses the pod's token leaves
|
||||
|
|
@ -208,24 +181,21 @@ controller may move there.
|
|||
operator Matrix admin grants is in the queue's key-value store, so the pod
|
||||
revokes the accounts the host controller granted. What the directory holds
|
||||
starts again from nothing: the forge avatar markers and the legacy webhook
|
||||
secret, which the secret store also holds. The controller's first start on
|
||||
the host imports a legacy grant file into the store, so run it there once
|
||||
before the switch.
|
||||
secret, which the secret store also holds. A legacy grant file on the host is
|
||||
not imported.
|
||||
- **The rev.** The unit's rev file, `/etc/hyperhive/swarm-controller.json`, is a
|
||||
`subPath` mount of the `swarm-controller-etc` ConfigMap, which a running pod
|
||||
never sees change. The Deployment's pod template carries `checksum/etc`, a
|
||||
hash of the ConfigMap's content, so a new rev rolls the pod. The host unit
|
||||
re-reads the file with no restart, so this restart, which drops the job graph,
|
||||
is new.
|
||||
hash of the ConfigMap's content, so a new rev rolls the pod, which drops the
|
||||
job graph.
|
||||
|
||||
## The queue
|
||||
|
||||
`swarm-nats` is the swarm's message queue: the NATS server and the
|
||||
auth-callout responder that admits its clients. Both belong to one pod,
|
||||
because a server whose responder is down refuses every connect. A switch
|
||||
moves the two together, and two servers or two responders never run: the
|
||||
Deployment has one replica and the `Recreate` strategy, and the prune unit
|
||||
holds the container back until the pod has gone.
|
||||
because a server whose responder is down refuses every connect. Two servers
|
||||
or two responders never run: the Deployment has one replica and the `Recreate`
|
||||
strategy, and the removed container stops before the pod can start.
|
||||
|
||||
- **Containers.** The responder is the pod's main container, `swarm-nats`,
|
||||
rendered from the unit the container runs, as the other daemons are. Beside it
|
||||
|
|
@ -288,32 +258,29 @@ holds the container back until the pod has gone.
|
|||
network-facing server sees the responder's and `tls-renew`'s processes, and
|
||||
under the same user can read their `/proc/<pid>/environ` and
|
||||
`/proc/<pid>/root`. The container had the same exposure, as one container.
|
||||
- **The host's units.** `swarm-nats-auth-secrets` and
|
||||
`swarm-bao-nats-callout-xkey` deliver into the container, so the configuration
|
||||
turns them off. `swarm-bao-nats-tls` stays: it issues the host's own copy of
|
||||
the leaf for the gateway's `/metrics` vhost, and with no container it has
|
||||
nothing to restart. The gateway's location dials the exporter's Service by
|
||||
- **The host's units.** The host has no unit that delivers keys or secrets to the
|
||||
queue. `swarm-bao-nats-tls` stays: it issues the host's own copy of the leaf
|
||||
for the gateway's `/metrics` vhost, and restarts no server. The gateway's location dials the exporter's Service by
|
||||
name where it dialled loopback.
|
||||
- **State.** The server's store directory, `/var/lib/nats`, is the container's
|
||||
own on the host, `/var/lib/nixos-containers/swarm-nats/var/lib/nats`: the
|
||||
PersistentVolumeClaim `swarm-nats-store` binds a static local volume on it,
|
||||
so a switch moves the process and not the bytes, and the pod has no state
|
||||
gate. The container's unit runs `chown -R nats:nats` on the directory before
|
||||
the server starts, and the pod's `fsGroup` gives its group read and write.
|
||||
so an upgrade moves the process and not the bytes, and the pod has no state
|
||||
gate. The pod's `fsGroup` gives its group read and write; files the old
|
||||
container wrote stay owned by the server's old user.
|
||||
The volume is `local`, with a storage class of its own and the `Retain`
|
||||
policy, and the claim binds it by name. Its `nodeAffinity` and the pod's
|
||||
`nodeSelector` both name the node label
|
||||
`hyperhive.darkest.space/state-nats`, so the pod and the directory stay on the
|
||||
node that carries it ([node labels](node.md#node-labels)).
|
||||
The prune unit stops a pod before the container starts, and the Deployment
|
||||
replaces its pod rather than running two, so one server reads the directory
|
||||
at a time.
|
||||
The Deployment replaces its pod rather than running two, so one server reads
|
||||
the directory at a time.
|
||||
nats-server keeps no lock or identity file in the store, so nothing there ties
|
||||
the directory to the side that wrote it.
|
||||
The module makes the directory on a host that never ran the container,
|
||||
because the volume needs it before the pod starts.
|
||||
The claim and its volume stay after a switch back, as every claim does, with
|
||||
the directory.
|
||||
The claim and its volume stay until the operator deletes them, as every claim
|
||||
does, with the directory.
|
||||
- **Readiness.** The pod is Ready when the responder's `/readyz`, on the pod's
|
||||
port 8080, passes and the server's exec probe does. The probe runs
|
||||
`wget` against `/healthz?js-enabled-only=true` on the server's monitor, which
|
||||
|
|
@ -340,14 +307,14 @@ systemd sandbox (`MemoryDenyWriteExecute`, `SystemCallFilter`, the read-only
|
|||
`ProtectSystem` and the rest) stays on the host, and `PrivateUsers` is the pod's
|
||||
own user namespace (`hostUsers: false`). 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. The host unit doesn't restrict the network.
|
||||
seccomp profile and no API token.
|
||||
The pod has a NetworkPolicy (`swarm-stt`, rendered with the pod): it may reach
|
||||
cluster DNS, and on the node's bridge address the store's pod listener, the
|
||||
identity provider, the queue and the hive collector, each on its one port. It
|
||||
admits no ingress. The kubelet's probes still reach the pod, because the node's
|
||||
own traffic to a pod is always admitted, and the pod doesn't serve anything
|
||||
else: requests reach it as queue messages, over the connection it opens. Where
|
||||
the queue runs in the cluster, the policy also allows the pods of the queue's
|
||||
else: requests reach it as queue messages, over the connection it opens. The
|
||||
policy also allows the pods of the queue's
|
||||
load balancer, in `kube-system`, on the queue's port, because the node forwards
|
||||
the `hostPort` they bind to them before the policy sees the packet.
|
||||
|
||||
|
|
@ -357,15 +324,15 @@ The pod of `swarm-ci-metrics` keeps pushing to its route of the swarm
|
|||
collector, `https://<swarm.otel.domain>/swarm-ci-metrics`, with the bearer it
|
||||
mints for itself each pass. The renderer sets no hive collector endpoint for it
|
||||
([telemetry](telemetry.md#metrics)). The pod holds no client certificate, so it
|
||||
doesn't push the `bao.client_cert.*` gauges of the host unit. Its one credential
|
||||
pushes no `bao.client_cert.*` gauges. Its one credential
|
||||
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
|
||||
`swarm-review-classifier` and `swarm-claude-login` keep no state, so 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
|
||||
|
|
@ -394,60 +361,52 @@ 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, 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, 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. 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.
|
||||
`module-eval-k8s` checks that the all-local host runs every service as a pod and
|
||||
none as a container, unit or timer; that the node defaults on through the
|
||||
all-local mode and through one toggle, and an explicit `false` stays false; that a
|
||||
host with the node off and a service on fails with a message naming the option
|
||||
and the services; that a controller without the TCP listener, the pod's bind
|
||||
address or the hive's resolver fails the evaluation; that the manifests sit in
|
||||
`services.k3s.manifests`; 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-nats-switch` moves the queue against the real secret store,
|
||||
with the egress intercept on. A sampler counts servers and responders every
|
||||
200 ms and sees at most one of each, and the container and the pod never
|
||||
together. The pod is Ready by its exec probe and has the init containers, the
|
||||
volumes and the Services the module renders and no `hostPort`, and its leaf's
|
||||
volume is a tmpfs. The load balancer binds the client port from `kube-system`
|
||||
and the Service has no node port. A client on the bridge reaches the queue by
|
||||
name and through the published port only, not by the pod's address or the
|
||||
node's, and a second node outside the node reaches the control port and not the
|
||||
queue's, as with the container; with `openFirewall` it dials the pod by name and
|
||||
verifies the name, and the responder in the pod admits it. A key written on the
|
||||
host before the switch is the pod's to read, a key the pod writes is the host
|
||||
server's after the switch back, and a stream written before a pod delete
|
||||
survives it: the replacement pod reads it from the same directory. The exporter
|
||||
answers the host's own processes through its Service and no pod or bridge
|
||||
client, and the switch back removes the pod and the load balancer's pod before
|
||||
the container starts.
|
||||
The VM test `k8s-services` 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 asserts that the host has no container, unit, timer
|
||||
or prune unit for any of them, and that each pod is Ready, logged in to the
|
||||
store with its ServiceAccount token, and minted a token with the client secret
|
||||
it read. The router's pod routes an event, and a pod deleted exits 0 within its
|
||||
grace period. For `swarm-stt` it asserts that the pod carries the unit's limits,
|
||||
requests nothing and is Burstable, runs in a user namespace, and keeps its cache
|
||||
in an `emptyDir`; its NetworkPolicy lets a queue request in and only DNS and four
|
||||
host ports out. A Job of the poller 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 pushes nothing. For the two claude daemons it asserts that the minter's
|
||||
token writes an agent's credentials and the classifier's can't, that the pod's
|
||||
root takes no writes, and that `claude` with `HOME` in the volume writes its
|
||||
config there while `claude` with `HOME` on the root leaves nothing there.
|
||||
|
||||
The VM test `k8s-controller-switch` moves the controller. It asserts one copy at
|
||||
each step by the switch's own timestamps and by a sampler, that the pod is Ready
|
||||
on `/readyz` with the volumes the module renders and no Secret, that its
|
||||
listener's leaf is the one its init container issued, valid as the listener's
|
||||
name against the hive's root, that the volume holding its key is a tmpfs, and
|
||||
that the listener refuses a client with no leaf. It runs the gateway's own
|
||||
controller location, from the module's text for each runtime, against the host
|
||||
unit and the pod: both answer an unsigned webhook 401. A changed rev rolls the
|
||||
Deployment onto a new pod and keeps the state volume, and the switch back
|
||||
deletes the pod and its AddOn before the unit starts.
|
||||
The VM test `k8s-nats` runs the queue against the real secret store, with the
|
||||
egress intercept on. The pod is Ready by its exec probe and has the init
|
||||
containers, the volumes and the Services the module renders and no `hostPort`,
|
||||
and its leaf's volume is a tmpfs. The load balancer binds the client port from
|
||||
`kube-system` and the Service has no node port. A client on the bridge reaches
|
||||
the queue by name and through the published port only, not by the pod's address
|
||||
or the node's, and a second node outside the node reaches the control port and
|
||||
not the queue's; with `openFirewall` it dials the pod by name and verifies the
|
||||
name, and the responder in the pod admits it. The pod's volume is the host's
|
||||
store directory, a stream written before a pod delete survives it, and the
|
||||
exporter answers the host's own processes through its Service and no pod or
|
||||
bridge client.
|
||||
|
||||
The VM test `k8s-controller` runs the controller. It asserts that the host has
|
||||
no unit for it, its listener leaf or a prune, that the pod is Ready on
|
||||
`/readyz` with the volumes the module renders and no Secret, that its listener's
|
||||
leaf is the one its init container issued, valid as the listener's name against
|
||||
the hive's root, that the volume holding its key is a tmpfs, and that the
|
||||
listener refuses a client with no leaf. It runs the gateway's own controller
|
||||
location, from the module's text, against the pod: it answers an unsigned
|
||||
webhook 401. A changed rev rolls the Deployment onto a new pod.
|
||||
|
||||
`k8s-bao-login` and `k8s-node` check the store's login and the node.
|
||||
|
|
|
|||
Loading…
Reference in a new issue