Watch
0
0
Fork
You've already forked hyperhive
0

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.
This commit is contained in:
maia 2026-11-25 14:56:39 +01:00 • committed by mara
commit 6acf1012cb
2 changed files with 80 additions and 0 deletions

View file

@ -15,4 +15,9 @@
tokenDir = "/var/run/secrets/hyperhive/bao";
tokenFile = "/var/run/secrets/hyperhive/bao/token";
# Exists while `swarm-bao-k8s-jwt-policy` waits for the root-only re-run of
# `swarmctl bao grant-bootstrap`. `PENDING_MARKER` in swarmctl/src/setup.rs
# is the same path.
pendingMarker = "/run/swarm-bao-k8s-jwt-pending";
}

View file

@ -526,6 +526,9 @@ in
case "$caps" in
*update*) ;;
*)
# `swarmctl setup status` reads this file: a unit that stays off
# exits 0, so it looks active.
touch ${podAuth.pendingMarker}
echo "the granter may not configure auth/${podAuth.mount} yet (capabilities: $caps), so the pods' login stays off." >&2
echo "one-time step, as root on this host (docs/1-getting-started/setup.md):" >&2
${lib.concatMapStringsSep "\n" (l: "echo ${lib.escapeShellArg " ${l}"} >&2") granterSetupSteps}
@ -533,6 +536,7 @@ in
exit 0
;;
esac
rm -f ${podAuth.pendingMarker}
# One public key per private key in the files, which may each hold
# several. A file k3s has not written is skipped, and no key at all