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

7,097 commits

Author SHA1 Message Date
atlas
f360efaf0c vm-tests: k8s-bao-login runs a pod's ServiceAccount login against the real store 2026-11-30 22:15:09 +01:00
atlas
6e59393830 k8s: pods log in to the secret store with their ServiceAccount token
The store gets a listener for the pods that asks for no client certificate,
open on the pod network's interfaces only, and a jwt auth mount with one
role per in-cluster service. The rendered pods run under a ServiceAccount
with a projected token in place of their client certificate.
2026-11-30 22:15:09 +01:00
atlas
c0e28f5f2b swarm-secret-client: log in with a service-account token under BAO_AUTH=jwt 2026-11-30 22:15:09 +01:00
atlas
5e4544b729 vm-tests: a running collector keeps its cursor when it switches to the static user 2026-11-30 22:15:09 +01:00
atlas
75b65d6719 k8s: pod logs and metrics reach the hive collector 2026-11-30 22:15:09 +01:00
atlas
f1eca9f191 vm-tests: k8s-node pod reaches the hive bridge's listeners by swarm name 2026-11-30 22:15:09 +01:00
atlas
f55068db28 k8s: pods resolve the swarm names of host-run services to the hive bridge 2026-11-30 22:15:09 +01:00
atlas
874da3358a vm-tests: k8s-node boots a node through deploy.k8s.enable 2026-11-30 22:15:09 +01:00
atlas
8fe2be87e7 k8s: deploy.k8s.enable runs a single-node k3s that holds the service images 2026-11-30 22:15:09 +01:00
maia
b3c82222b3 vm-nightly: run the k8s-swarm-images test in the nightly matrix
The vm-test-list lint, added on main, requires every test in nix/vm-tests.nix
to be in the nightly matrix.
2026-11-30 22:15:09 +01:00
atlas
258a232a7e docs: describe swarmctl migrate, the all-local swarm's move onto k8s 2026-11-30 22:15:09 +01:00
atlas
5a628a1edb k8s: render the in-cluster services' manifests from their units
services.hyperhive.k8s.enable renders a Deployment (swarm-controller,
swarm-notify-router) or CronJob (swarm-ci-metrics) per service this host
deploys into system.build.k8sManifests. The renderer reads each evaluated
unit: its environment, LoadCredential ids, state and runtime directories,
ExecStart and timer. Files the unit names are mounted at the same paths, so
the environment carries over as it is. Secrets are referenced by name only.

No unit changes. checks: k8s-manifests-all-local (kubeconform -strict,
offline schemas) and module-eval-k8s; the allLocal fixture turns the
rendering on.
2026-11-30 22:15:09 +01:00
atlas
b9033251ba vm-tests: a k3s node harness, and the swarm images boot as pods 2026-11-30 22:15:09 +01:00
maia
32a38ac8e4 hive-priv: the egress lock test waits for a lock a forked child still shares 2026-11-30 22:11:52 +01:00
maia
d5f5ee21be swarm-nats-auth: refuse a service client id that fits a hive or a second role 2026-11-30 21:59:38 +01:00
argus
ac7d6d1c44 review-classifier: a rule against a hand-rolled retry or backoff
A retry or backoff policy written out by hand (a capped doubling wait, a
jitter from the clock, a try count with a sleep) goes against the workspace's
own dependency on backon. The rule flags a diff that adds one; the controller
test lists the rule name.
2026-11-30 21:55:32 +01:00
maia
7240c148f4 public-cache: build and push the cargo dependency closures 2026-11-30 21:47:55 +01:00
atlas
c41b84bff7 swarm-queue-client: back off failed token rotations 2026-11-30 21:35:38 +01:00
atlas
790cdd43c8 gateway: answer 503 for a store outage and 429 for the rate limit, and retry both in swarm-logs and swarm-metrics 2026-11-30 21:34:53 +01:00
atlas
57b071cc34 swarm-authelia-bridge: bound the identity path and answer errors the controller can act on 2026-11-30 21:34:28 +01:00
maia
719947ea04 swarm-queue-client: bound the token a caller supplies, and log a token body that cannot be read 2026-11-30 20:52:27 +01:00
maia
d3c084a0e3 swarm-authelia-bridge: check the username charset of the user being written
publish -> render_yaml -> validate re-checked validate_username on every user
in the file, humans included. authelia accepts names the charset refuses
(first.last@corp), so one hand-added user made every EnsureAgentIdentity fail
with a 500 until it was removed, while readiness (which only parsed the file)
stayed green. The reserved-name guard already avoids this hazard.

validate now checks only what a write would emit wrong (control characters),
for every user. The charset check stays on the name a request writes, in
handle. A user outside the charset is passed through unchanged and named in a
warn line on each write. Readiness now also runs that check, so a file the
bridge cannot render is not ready.
2026-11-30 19:23:38 +01:00
maia
66b384cd07 swarm-metrics-auth: bring the module comment back to 30 lines 2026-11-30 19:23:20 +01:00
maia
5ae00f8c3e swarm-queue-client: fix the max_payload and stream-size docs, share the token form, re-check rotation under the lock 2026-11-30 19:02:46 +01:00
maia
56cc8a86ec swarm-authelia-bridge: authorize a request before parsing its body
The handler took `Json<BridgeRequest>`, which axum runs before the handler
body. A caller with no token and a malformed body got axum's rejection
(415/400/422), whose text is serde's ("unknown variant ..., expected one of
..."), and not the one generic 401 an unauthenticated caller is meant to see.

Take the body as bytes, authorize, then parse. A caller that is let in and
sends a body that doesn't parse gets a 400 with the parse error, as before in
substance. The request's content type is no longer checked.
2026-11-30 18:24:13 +01:00
atlas
4a7df3f804 swarm-controller: agent permissions and inference take the settings sub-state 2026-11-30 18:16:28 +01:00
maia
8717e68021 swarm-nats-auth: the responder refuses to start under a server callout timeout its lookup bound does not fit 2026-11-30 17:32:51 +01:00
maia
31274ebf7f swarm-nats-auth: fix four doc comments, and record why the request goes unchecked
- request.rs pointed at module docs on main.rs for why the request signature
  is not verified; they said nothing. It now says why, here and in
  docs/4-implementation/swarm/credentials.md ("What authenticates a callout
  request"), and so do xkey::open and main.rs's module docs: only the
  responder's own key can publish to the request subject, a forger with a
  valid bearer gets what a normal connect gets, and nats-server makes a new
  xkey at each start and has no option to set it, so there is no key to pin.
  The guard is the module-eval case "the callout account has exactly one member
  and no system account is configured"; the docs say to revisit this if that
  changes.
- request.rs said base64url is written out rather than pulled in; it calls
  data_encoding, a direct dependency.
- respond.rs said `now` is injected into sign(); sign() takes no clock.
- oidc_secret.rs named swarm-bao.nix for natsAuthReaders; it is in
  swarm-bao-readers.nix.
2026-11-30 17:09:20 +01:00
maia
fd1761f105 swarm-authelia-bridge: refuse an EnsureAgentIdentity name the roster would drop
`handle` checked the store's username charset, which is wider than an agent
name's (it holds humans too: uppercase, `.`, `_`). The roster (`list`) keeps
only subjects that parse as an `Ident`, so `EnsureAgentIdentity("Atlas")`
wrote a user the roster then skipped for good.

Parse the name as an `Ident` first and refuse anything else, before the store
is touched. The refusal goes out the existing error path.
2026-11-30 17:09:06 +01:00
maia
61636cfcc2 swarm-metrics-auth: remember a "no bearer stored" answer for the cache TTL
When the store answered that it holds no usable bearer, the cache was reset
to its default, which forgot that the answer had just been asked for. Every
request after that started its own bao login and read, one at a time (up to
5 s each), so anyone sending `Bearer <64 hex>` before Grafana's bearer exists
queued Grafana's real requests behind those lookups, on a route with no rate
limit because the responder was said to read the store at most once per TTL.

Remember the answer for the TTL, as a stored bearer is, and deny without a
lookup until it passes (`empty_until`). A bearer that arrives ends it. The
"at most once per cache TTL" comments in swarm-victorialogs.nix and
swarm-victoriametrics.nix now also say the failure case, one lookup per few
seconds while the store does not answer.
2026-11-30 17:08:38 +01:00
maia
c815e0d59b swarm-logs-auth: one store login serves the credential and the grant
An uncached request read the agent's queue credential (swarm_agent_verify::
verify through Store::lookup) and then its permission grant
(Store::read_optional), and each read did its own bao cert login, so a cold
bearer cost two logins.

Add swarm_agent_verify::Store::connect, which logs in once and returns a
Connection that implements CredentialSource and reads any path. swarm-logs-auth
connects once per uncached request, bounded by the lookup timeout, and uses the
connection for both reads. A login that fails or times out denies the request
and reads nothing. Store's own per-read login stays for swarm-nats-auth.
2026-11-30 17:08:20 +01:00
maia
564842d332 swarm-victorialogs, swarm-victoriametrics: the four responders' socket directories admit only the service and nginx 2026-11-30 17:06:32 +01:00
maia
17057e4258 swarm-nats-auth: a callout lookup is cut off at the request's exp 2026-11-30 17:06:02 +01:00
maia
72d1e181e3 swarm-nats-auth: refuse a credential that is already over by our clock
The user JWT's exp is min(credential exp, now + 1h) with no floor at now.
When this responder's clock is ahead of the identity provider's, a token the
provider calls active can already be over here: the minted JWT then has
exp <= iat, the server refuses the client, and the log says granted=true.

Check respond::outlives(now, expires) before granting. A credential that is
over at now gets the same denial as an inactive token, and the refusal is
logged with the credential's expiry and now (granted=false on the request
line). grant() takes the now the check used, so the JWT it mints and the
check can't disagree.
2026-11-30 15:59:53 +01:00
maia
4dc0d57954 swarm-authelia-bridge-sock: say that every verb is controller-only
The ListOperators doc said every other verb admits any active token and this
one is refused to other callers. The bridge's classify admits only the
controller's client id, for all three verbs, and answers any other active
token 403, as the README says. The doc understated the restriction.
2026-11-30 15:59:26 +01:00
maia
071e4b1717 swarm-logs-auth, swarm-metrics-auth: say which requests each one is sent
swarm-logs-auth's module doc said nginx sends it every /select/logsql/
request. The log store's nginx map sends it only `Bearer swarm-agent.`
requests; Grafana's 64-hex bearer goes to swarm-metrics-auth and everything
else to authelia. swarm-metrics-auth's said it was the metrics store's
responder for Grafana, but the same binary also guards the log store. Both
docs now describe the routing the nginx maps in swarm-victorialogs.nix and
swarm-victoriametrics.nix do.
2026-11-30 15:59:04 +01:00
atlas
c79c894ebe swarm-controller: set_agent_state takes the placement sub-state and the forge 2026-11-30 14:09:06 +01:00
atlas
00e143fe7b swarm-controller: agent schedules and limits take a settings-only sub-state 2026-11-30 13:56:40 +01:00
atlas
5616b221b8 swarm-controller: the agents status handler takes two narrow sub-states 2026-11-30 13:56:00 +01:00
iris
c0f6118c78 swarm-ui: an open agent's details close with a cross in the identity card
The "← agents" button sat on a row of its own above the card and read as a
stray control, and "back" was the wrong word beside a visible list. The card's
top line now ends in a close cross (the shared Badge with the close icon, as in
the group page's panes), at every width. A name the roster doesn't have keeps
the "← agents" button, since there is no card to carry the cross.
2026-11-30 12:45:37 +01:00
atlas
9b19fbe398 swarm-controller: placement sub-state for create_agent, get_hive_wanted, post_agent_custom 2026-11-30 12:41:11 +01:00
atlas
78a59f1e79 swarm-controller: agent I/O and reader handlers take narrow sub-states 2026-11-30 12:40:34 +01:00
maia
5079eb58d0 swarm-secret-client: name the store-answer mappings and test them
Each optional read, listing, delete, SSH CA read, alias lookup and versioned
read in SecretStore decided what a 404 (or a 400, or an empty 204) means
inline, next to the vaultrs call. Move those decisions into small functions
(none_when_absent, empty_when_absent, done_when_absent, ssh_ca_key,
entity_from_lookup, versioned) and the cert-role policy write's request into
set_cert_role_policies_request. Behaviour is unchanged.

Test them with constructed ClientError values: 404 is nothing there, every
other status (400, 403, 429, 500, 503) stays the store's error with the
status in the message, a blank SSH CA key is none, an empty alias answer is
a miss and any other parse failure is not, a versioned read keeps the number
and time and a wrong-shaped object is an error. Also pin the cert-role read
structs and the paths the grant names.

The vaultrs call lines themselves stay unit-uncovered by design; the VM tests
drive them against a real bao.
2026-11-30 12:40:17 +01:00
atlas
1d19836cd6 swarm-controller: the review handlers take a review-only sub-state 2026-11-30 11:20:52 +01:00
flake-bot
8eed02ab92 nix flake update 2026-11-30 10:27:32 +01:00
atlas
98341e24a6 swarm-controller: the forge webhook takes two narrow sub-states 2026-11-30 03:46:26 +01:00
atlas
0fd9847363 swarm-controller: the notify handlers take a status-only sub-state 2026-11-30 02:43:19 +01:00
atlas
52bfca85ad swarm-controller: git_forge read handlers take a forge-only sub-state 2026-11-29 14:02:12 +01:00
atlas
b184f4e096 swarm-controller: secrets handlers take their own sub-state via FromRef 2026-11-29 14:01:44 +01:00
atlas
c3773828c9 swarm-controller: builder-runs handlers take their own sub-state via FromRef 2026-11-29 12:51:29 +01:00