Watch
0
0
Fork
You've already forked hyperhive
0

full-setup and the host swarmctl reach the controller as a pod, not through a host socket

This commit is contained in:
atlas 2026-11-26 09:22:29 +01:00 • committed by mara
commit 087c51eef6

View file

@ -44,7 +44,7 @@ See `swarm-authelia-bridge/README.md` for what both writers must uphold.
## Configuration
The nix deployment sets every path, each derived from an option it already
has: `swarm-controller.nix` sets the socket, and `glue-controller-env.nix` sets
has: `swarm-controller.nix` sets the swarm and the trust bundle, and `glue-controller-env.nix` sets
`SWARMCTL_AUTHELIA_BIN` and `SWARMCTL_AUTHELIA_USERS_FILE`, only where
authelia runs on the same host. It also sets
`SWARMCTL_BAO_BOOTSTRAP_TOKEN_FILE` and `SWARMCTL_BAO_BOOTSTRAP_POLICY`, only
@ -61,7 +61,7 @@ an error.
| `SWARMCTL_AUTHELIA_UNIT` | authelia's unit inside that container |
| `SWARMCTL_BAO_BOOTSTRAP_TOKEN_FILE` | where `bao grant-bootstrap` places the 24h grant token |
| `SWARMCTL_BAO_BOOTSTRAP_POLICY` | the `bao-bootstrap` policy file `bao grant-bootstrap` writes |
| `SWARM_CONTROLLER_SOCKET` | the controller's unix socket, used when no swarm is named |
| `SWARM_CONTROLLER_SOCKET` | a controller socket to use when no swarm is named; the module sets none, as the controller is a pod |
| `SWARMCTL_LOGIN_DEFAULT_SWARM` | `https://<swarm domain>` of this host's swarm, for `login` |
| `SWARMCTL_SWARM` | the swarm's domain, bare or `https://`: reach the controller there; the module defaults it to this host's swarm |
| `SWARMCTL_CA_FILE` | a PEM CA to trust beside the system roots, for `SWARMCTL_SWARM` |
@ -112,9 +112,9 @@ queued: job node 42
agent "agent2" will be deployed to hive "alpha" once the job graph runs; `swarmctl` does not wait for it
```
`POST /api/agents` on the swarm-controller, over its unix socket
(`--controller-socket`, else `SWARM_CONTROLLER_SOCKET`, which the nix
module sets from the daemon's own `socketPath`). It prints the queued
`POST /api/agents` on the swarm-controller, through the swarm's gateway
(`--swarm`, else `SWARMCTL_SWARM`, which the nix module sets to the host's own swarm;
see "Reaching the controller" below). It prints the queued
job's node id **and stops there**.
It deliberately does not wait. The endpoint queues a DAG — SSO identity,
@ -187,8 +187,8 @@ as it arrives, with no total-request timeout. The header-state stream
forge: "mara" is now a site admin
```
`POST /api/forge/users/{name}/admin` on the swarm-controller, over the same
socket as `agent create`. It never creates an account: the forge makes a
`POST /api/forge/users/{name}/admin` on the swarm-controller, through the same
gateway as `agent create`. It never creates an account: the forge makes a
person's on their first login through authelia, and until then this fails
saying so. Running it on a site admin changes nothing, and an agent's name is
refused. The response body comes from `swarm-controller-api`, imported in
@ -204,8 +204,8 @@ refused. The response body comes from `swarm-controller-api`, imported in
# swarmctl schedule rm kqzpmwab
```
The `/api/schedules` routes on the swarm-controller, over the
same socket as `agent create`; each verb waits for the stored result. What a
The `/api/schedules` routes on the swarm-controller, through the
same gateway as `agent create`; each verb waits for the stored result. What a
schedule does once stored is in
[`docs/2-handbook/swarm/schedules.md`](../docs/2-handbook/swarm/schedules.md). The bodies come
from `swarm-controller-api`, imported in `src/schedule.rs`.
@ -273,8 +273,8 @@ Read-only, and it needs no token. Where each step is read from:
A check that cannot run gives `unknown` with the reason and the rest still
print: `bao` is only on `PATH` on the host running swarm-bao, the users file is
only on the authelia host, and the controller socket only on its host (or `--swarm`; on a controller host the
default swarm needs `swarmctl login` first). The exit code is 0 when every step it can see has finished and 1
only on the authelia host, and the controller only through the gateway, which needs
`swarmctl login` first (the host's own swarm is the default, so a host that has not logged in reports `unknown (not logged in…)`). The exit code is 0 when every step it can see has finished and 1
otherwise, counting an `unknown` from a failed check; step 10, another agent,
is optional and does not count.
@ -295,11 +295,12 @@ $ swarmctl schedule list
`--swarm` (before or after the verb) names the swarm, else `SWARMCTL_SWARM`; either takes the
bare domain too. On a swarm-controller host the module's wrapper sets `SWARMCTL_SWARM` and
`SWARMCTL_LOGIN_DEFAULT_SWARM` to the host's own swarm, so the host's `swarmctl` uses the gateway
too and needs one `swarmctl login`. The gateway names the sender from the SSO session, and the
controller's socket serves nginx alone. Both are defaults, so a value you set wins. An empty
`SWARMCTL_SWARM` (or `--swarm ""`) puts the verbs back on `SWARM_CONTROLLER_SOCKET` as root. That
route sends no `Remote-User`, so the routes that name the sender answer 401. Nothing in setup needs it:
`swarmctl login` needs only authelia and your SSO account, both there by step 2.
too and needs one `swarmctl login`. The gateway names the sender from the SSO session. Both are defaults, so a value you set wins.
The controller runs as a pod and has no socket on the host, so the gateway is the only way in. `swarmctl user add`
writes authelia's users file and needs no controller, so `swarmctl login` needs only authelia and your SSO account, both there by step 2.
`--controller-socket` and `SWARM_CONTROLLER_SOCKET` still name a unix socket for a controller reached that way
(none the module sets); with neither a swarm nor a socket the verb stops and says to name the swarm.
`login` finds the swarm's SSO provider itself: the gateway's 401 at `/api/`
names a public metadata document (RFC 9728) that names authelia, so `--swarm`