Watch
0
0
Fork
You've already forked hyperhive
0
Commit graph

7,141 commits

Author SHA1 Message Date
atlas
25e59b8d96 give Grafana's include file the gateway group's mode in the test and docs
The credential unit already writes every store's nginx file as root:nginx 0640,
and grafana.conf is one of them. The credentials page gives it the same modes
and the test checks them, and that the gateway's user reads the file and not
the password.
2026-11-28 10:01:39 +01:00
atlas
4aa0a4cc2a wait for the gateway's reload before asking Grafana's /metrics
nginx's reload is graceful: workers on the old configuration answer until they
drain, so the request right after the credential unit's restart and the reload
could still meet the empty include file and answer 401. The subtest polls for
the 200 as the stores' subtests poll for their records.
2026-11-28 10:01:39 +01:00
atlas
d007dfd7dc keep the dashboard's probe out of the stub's forge requests
The identity-provider stand-in recorded Grafana's datasource-proxy probe with
the same forge_token_ok field as a forge request, so the poller's subtest,
which takes every record with that field for a forge request, counted three
probes and asserted that they carried the forge token.
2026-11-28 10:01:39 +01:00
atlas
c42935bd1d stop the dashboard subtests overwriting the driver's pod()
The subtest that reads the Grafana pod's spec assigned it to `pod`, which is
the name of lib/k3s.py's pod(); the next wait_pod() call, after the pod delete,
died with "'dict' object is not callable".
2026-11-28 10:01:39 +01:00
atlas
f8fb71253e let the init container's temp file take its umask
fetch-secrets ran under umask 0227 for the files it writes, which made the
mktemp file of grafana_secret_key mode 0400: the redirect of bao's stderr
into it failed, every bao call in the helper answered 1, and the init
container exited 1 before it stored or read the key. The umask now covers
only the writes of put(), the helper chmods its own file, the script test runs
under that umask, and a pod that does not start prints its init containers'
logs.
2026-11-28 10:01:39 +01:00
atlas
bd0cff47f9 keep the container's secret key through the pod's first start
Grafana wraps the data keys of its database with secret_key, and a different
key makes them undecryptable, which grafana cli's re-encrypt cannot repair
(it decrypts with the current key first). So the init container takes the
store's key, else the file the container generated, else a new key, and a new
key only over a database that holds no data_keys row; otherwise it exits
non-zero naming the leaf. The file reaches it read-only through a claim on a
static local volume, because the namespace refuses a hostPath.
2026-11-28 10:01:39 +01:00
atlas
9f62e71dae run grafana as a pod in the cluster
The Deployment swarm-grafana replaces the swarm-grafana container: one
replica on a static local volume that is the container's data directory,
an init container that fetches the OIDC client secret and creates the
administrator password, the datasources' bearer and the encryption key in
the secret store, and a sidecar that keeps the controller's Viewer token.
The datasources reach the stores through the gateway with that bearer, and
Grafana's /metrics asks for the stores' kind of credential, which the vhost
sends. The five host units, the journal forwarder, its client glue and the
unix-socket directory go with the container.
2026-11-28 10:01:39 +01:00
atlas
26ef09b0d7 name the grafana pod's sidecar where the controller's token errors point
The controller's missing-token error and the two crates' docs named a host
unit that no longer runs.
2026-11-28 10:01:39 +01:00
atlas
b1b95b5407 keep the pods' runtime volume in memory
A service's RuntimeDirectory is a /run, which never reaches a disk; the
pod's volume for it was an emptyDir on the node's disk.
2026-11-28 10:01:39 +01:00
atlas
0998c82555 k8s: networkmanager leaves the pod network's interfaces unmanaged 2026-11-28 09:59:25 +01:00
atlas
e0b3c0a644 k8s: the gateway's group reads the store credential files nginx includes 2026-11-28 09:59:25 +01:00
maia
132d876668 vm-tests: the typecheck fails a step that rebinds a function of its script
A VM test script and `lib/k3s.py` share one namespace, so a step that assigns
`pod = ...` replaces the library's `pod()` for every later call and the test dies
mid-run with `TypeError: 'dict' object is not callable`. `ty` and
`ruff --select F` accept a module-level rebinding, so this cost a full VM round
on #6947.

`vm-test-shadow-scan.py` parses the script and fails when a name bound at module
level (assignment, `for` or `with` target, `import ... as`, walrus, `except ... as`)
is also a module-level `def`. It looks into `with`, `if`, `for`, `while` and `try`
bodies, where `with subtest(...)` steps live, and not into function or
comprehension bodies. Every `vm-test-typecheck-<name>` runs it on the script alone.
`vm-test-typecheck-shadow-control` passes only when it rejects each form of
rebinding and accepts the same names where they are local.

The one existing case, `sources` in `k8s-services`, is renamed `cred_sources`.

Closes #6951
2026-11-28 09:59:25 +01:00
atlas
358a13752c drop the duplicate re import from the k8s-services script 2026-11-28 09:59:25 +01:00
atlas
9c64b80538 bind health listeners to the pod's loopback and probe them by exec 2026-11-28 09:59:25 +01:00
atlas
448c3bf1b3 k8s-node asserts the poller's CronJob and default-deny policy in the hyperhive namespace, which the cluster now holds 2026-11-28 09:59:25 +01:00
atlas
8cfd52cd4c move flannel's wireguard port to 51830, advertise the node address as the tunnel endpoint, drop the 51820 assertion 2026-11-28 09:59:25 +01:00
atlas
44ae81470e run flannel's wireguard-native backend on every k8s node 2026-11-28 09:59:25 +01:00
maia
e8dc0ebac4 k8s: the store-credential unit starts at fork, off the boot and switch path
`swarm-bao-store-auth` was a retrying oneshot on multi-user.target. A
oneshot's start job stays pending through its restarts, so a boot or a switch
with the secret store sealed waited on it for up to 15 minutes, the same
shape as #6901's CA publisher.

It is now `Type=simple` with the shared retry kept: the start job is done at
fork and the unit keeps trying until the store answers. `RemainAfterExit`
leaves it `active (exited)` once the credential is out, and the 15-minute
start timeout goes, as a start job done at fork has no use for it. Nothing
orders after the unit: the gateway reads the file at its next reload and the
pods wait in ContainerCreating for the Secret.

`is-active` is now true while the script runs and `systemctl restart` returns
at fork, so the k8s-services and k8s-nats tests wait for `SubState=exited` where they relied
on either.

Closes #6937
2026-11-28 09:59:25 +01:00
atlas
da53e19636 the queue's exporter asks every request for a login the gateway supplies 2026-11-28 09:59:25 +01:00
atlas
9b12532fc1 the log and metrics stores ask every request for a credential the gateway supplies
Each store runs with -httpAuth.* and a credential from the secret store, published to the namespace as a Secret by the host. The gateway's locations send it after auth_request has passed, and the collector's scrape and push take the same one, so a process on the node that bypasses the gateway is refused.
2026-11-28 09:59:25 +01:00
atlas
11be43a2e9 the responders drop the unix-socket listener nothing uses since WP4/WP5
swarm-logs-auth and swarm-metrics-auth serve the TCP address --listen names and nothing else. Every unit of theirs runs as a pod, and the VM test that ran them on a socket takes --listen.
2026-11-28 09:59:25 +01:00
atlas
681426b53b run the metrics store and its auth responders as pods 2026-11-28 09:59:25 +01:00
atlas
1606f1e9bb semi-spread: show the controller pod's log where the test printed the empty journal
The swarm-controller runs as a pod, so journalctl -u swarm-controller on the
swarm machine has no entries. When create_agent gives up, and when the
agents do not settle, the test now prints the pod's log, and counts the
deploy requests in it instead of in the journal.
2026-11-28 09:59:20 +01:00
atlas
d579c54f82 k8s: deny ingress to every pod by default 2026-11-28 09:59:20 +01:00
atlas
f349137d73 swarmctl, vm tests: wait for the store's active node after an unseal
An unsealed store has no active node for a few seconds and refuses writes
with "local node not active". swarmctl bao grant-bootstrap now repeats
bao policy list and bao policy write every second, up to a minute, while
the store answers that; setup.md says so. The full-setup and semi-spread
tests wait for bao policy list with the root token before the bootstrap.

full-setup.py: when create_agent gives up it also prints the controller
pod's logs, the pod list and the swarm builder's journal. A run that
failed with no archetype "reviewer" for 13 minutes left no controller or
builder output to read.
2026-11-28 09:59:20 +01:00
atlas
dd55750b8d k8s: the ca-trust publisher no longer holds multi-user.target while it waits for the setup 2026-11-28 09:59:20 +01:00
atlas
06c1a04b0a k8s-services: seed with the stream content type, give the grafana responder its own port name, and print gateway diagnostics on a refusal
the grafana responder's service targeted the port name api, which resolves to the logs responder's container; its port is now grafana-api.

the node-ready wait is raised from 300 to 600 seconds: slow k3s image imports on this test's machine kept the node from registering in vm-nightly 8992 and 8997, so the test never reached the subtests this change fixes.
2026-11-28 09:59:20 +01:00
atlas
9496d934b7 swarm-nats: the pod's raw rule lets through the interfaces the firewall opens the client port on
The hostPort's raw-table drop for the queue's client port let through only the host's loopback, the bridge and the pods' interfaces, so a hive on another host, reaching the queue over wg0 where the firewall's own rule opens the port, timed out. The rule now also returns for every interface whose networking.firewall.interfaces entry opens the port. semi-spread dumps the queue's network state when the hive cannot reach it, and asserts the port answers over wg0 and not on the public address.
2026-11-28 09:59:20 +01:00
maia
286081d43a k8s: refuse a workload name that starts with the legacy hive- prefix
The forge and matrix services carry a hive- prefix from their per-hive
container days. Neither runs in the cluster on k8s/v1 yet, so nothing
is renamed here: the renderer now fails the evaluation of any in-cluster
workload that carries a name starting with hive- (an object key, an
object's name, or its app label), so the move cannot bring the prefix
along. A module-eval case pins the lookup on literals and holds the
rendered hosts to it.
2026-11-28 09:59:20 +01:00
atlas
754eeba010 k8s-services: the seeded log record is found by a word of its message, and a stuck seed fails its unit 2026-11-28 09:59:20 +01:00
atlas
c9da6e7506 run the log store and its auth responders as pods
swarm-logs-auth and swarm-metrics-auth take --listen for a TCP address beside
--socket. The log store is a Deployment on a static local volume that is its
old container's data directory, behind a ClusterIP Service the gateway dials by
name. Its two auth_request responders are one unpinned pod with a jwt role.
The renderer gains a plain HTTP listener, a probe path, fsGroupChangePolicy,
and one policy for a pod with both a listener and egress.
2026-11-28 09:59:20 +01:00
atlas
9acbbea7c2 swarmctl: drop the controller socket target, the host has no socket to reach 2026-11-28 09:59:10 +01:00
atlas
bb7d616ce9 full-setup and the host swarmctl reach the controller as a pod, not through a host socket 2026-11-28 09:59:10 +01:00
atlas
3682c22fb1 k8s vm tests: create the agent netns before k3s starts a pod, and delete pods strictly again 2026-11-28 09:59:10 +01:00
atlas
e9e7b2c4e4 k8s-join: wait through a pull from a peer that fails first, and print the registry state when it keeps failing 2026-11-28 09:59:10 +01:00
atlas
57d40ae8ea require k8s: swarm services with a pod run in the cluster only 2026-11-28 09:59:10 +01:00
atlas
272af0b3e8 let a second machine join the main node's k3s and run pods from images only the main node holds 2026-11-28 09:59:10 +01:00
atlas
c0cc44705f k8s-nats-switch: set the default namespace again after a switch restarts k3s 2026-11-28 09:59:10 +01:00
atlas
354354859f pin queue and poller state to per-service node labels instead of the hostname 2026-11-28 09:59:10 +01:00
maia
7b72cb3ce0 node.md: keep the punctuation outside quotes out of the new sentence 2026-11-28 09:59:09 +01:00
maia
0d98812e71 swarmctl setup status: the comment names the marker file, not the journal 2026-11-28 09:59:09 +01:00
maia
3d4a92d7d2 swarmctl setup status: show the pending bootstrap re-run for the pods' login
`swarm-bao-k8s-jwt-policy` exits 0 when the bootstrap token lacks
`sys/auth/jwt-k8s`, so a store set up before the node looked fine in
`swarmctl setup status`: the unit is active and nothing marks the root-only
`swarmctl bao grant-bootstrap` re-run as pending.

The unit now keeps /run/swarm-bao-k8s-jwt-pending while it stays off and
removes it before it writes the mount's config. `setup status` reads the file
and shows step 3, "granter bootstrapped", as not done, naming the verb.
`module-eval-k8s` pins the order of the touch, the exit and the removal.
2026-11-28 09:59:09 +01:00
maia
4693d136e3 docs: turning the node on restarts the store, so unseal before the re-grant
node.md named the second grant-bootstrap and nothing before it. The
first activation with deploy.k8s.enable adds a pod listener to the
store's configuration, which restarts container@swarm-bao. A shamir
store comes back sealed, the units that read it fail, and
grant-bootstrap cannot log in until an operator unseals it. A pkcs11
store unseals itself.

node.md now has the order for a swarm that already runs: unseal on a
shamir store, then grant-bootstrap once, then restart the policy units,
as setup.md does. Only node.md changes.

Closes #6844
2026-11-28 09:59:09 +01:00
maia
00b5a191ef swarm-nats: order the host queue's callout-key unit after the prune
A switch back deletes the queue's pod with --wait, so the pod is still
ending while swarm-nats-k8s-prune runs. swarm-bao-nats-callout-xkey was
ordered before the container but not after the prune, so on a slow
apiserver its ensure-callout-keys ran beside the pod's responder and the
switch test saw two responders. On a host with the cluster node the unit
now starts after the prune. The prune names the unit nowhere, so there is
no cycle, and without the node nothing changes.

Closes #6831
2026-11-28 09:59:09 +01:00
atlas
b4c788b274 remove swarmctl migrate, migrate.json and the migrate docs 2026-11-28 09:59:09 +01:00
atlas
d402568621 vm-tests: k8s-bao-login expects the roles the module names
The test listed three jwt roles by hand, and the store has eight since the queue, stt, the review classifier and the claude minter joined, so it failed at the role assertion before it reached any pod. The list is now the module's own k8sPrincipals, sorted.
2026-11-28 09:59:09 +01:00
maia
622b4fff96 k8s VM tests: wait for the store's active node after the unseal
The tests waited on `bao status`, which answers once the node is
unsealed and before raft has elected it, so the first policy write raced
the election and failed with "local node not active but active cluster
node not found". `unseal_bao` unseals and then waits for sys/leader to
say the node is the leader; the four tests that bootstrap the store use
it at both unseal sites.

Closes #6807
2026-11-28 09:59:09 +01:00
atlas
b7ce9ce661 k8s: the hyperhive namespace enforces pod security restricted
No pod in the namespace has a hostPort any more, and the census found nothing else that restricted refuses. The namespace now carries the restricted level for enforce, warn and audit, so the API server refuses a pod that drifts. The bao-login test's probe pods get the container security context restricted asks for. The controller switch test shows the API server admitting a compliant pod and refusing the same pod with a host port, a kept capability or privilege.
2026-11-28 09:59:09 +01:00
atlas
44aecd6368 k8s: the queue's client port is a loadbalancer service
The queue's client port was a hostPort on 0.0.0.0, which Pod Security baseline and restricted forbid. It is a LoadBalancer Service now, which k3s's service load balancer binds on every address of the node with a hostPort of its own in kube-system, so hives on other hosts keep their URL. No node port is allocated. The stt policy allows the load balancer's pods in place of the queue's, and the prune unit waits for them to go before the host unit starts. The egress published-port rule and the raw-table rules apply to the load balancer's hostPort as to the pod's.
2026-11-28 09:59:09 +01:00
atlas
ec7514fc5a egress: the forward chain accepts the flows the host publishes for the agents
On a host with the egress intercept on, the forward chain rejected an agent's traffic to the queue once the queue ran as a pod: the pod's hostPort rewrites the destination to the pod, and the packet then leaves the bridge for the cluster. The chain now accepts TCP that the host's NAT redirected whose original destination is the bridge's address at a published port, which the queue adds when it runs in the cluster. Everything else from the bridge to the cluster stays refused. The nats switch test runs with the intercept on.
2026-11-28 09:59:09 +01:00