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:
parent
4159d01abe
commit
9be6c57a3e
1 changed files with 80 additions and 0 deletions
|
|
@ -1402,6 +1402,28 @@ let
|
|||
&& lib.hasInfix "bound_subject=system:serviceaccount:hyperhive:swarm-review-classifier" jwt
|
||||
&& lib.hasInfix "token_policies=swarm-claude-login " login;
|
||||
}
|
||||
{
|
||||
# `swarmctl setup status` reads this file to tell that the root-only
|
||||
# grant-bootstrap re-run is pending (`PENDING_MARKER` in
|
||||
# swarmctl/src/setup.rs). The unit must create it on the stay-off path and
|
||||
# remove it before it writes the mount's config, or the check goes quiet
|
||||
# or never clears.
|
||||
name = "the pods' login unit keeps the marker file `swarmctl setup status` reads while it waits for the root step";
|
||||
ok =
|
||||
let
|
||||
jwt = withNode.systemd.services.swarm-bao-k8s-jwt-policy.script;
|
||||
marker = "/run/swarm-bao-k8s-jwt-pending";
|
||||
touched = lib.splitString "touch ${marker}" jwt;
|
||||
cleared = lib.splitString "rm -f ${marker}" jwt;
|
||||
# What follows the one `touch`, up to and after the one `rm`.
|
||||
between = lib.head (lib.splitString "rm -f ${marker}" (lib.elemAt touched 1));
|
||||
in
|
||||
lib.length touched == 2
|
||||
&& lib.length cleared == 2
|
||||
&& lib.hasInfix "rm -f ${marker}" (lib.elemAt touched 1)
|
||||
&& lib.hasInfix "exit 0" between
|
||||
&& lib.hasInfix "bao write auth/jwt-k8s/config" (lib.elemAt cleared 1);
|
||||
}
|
||||
{
|
||||
name = "the four daemons' and the poller's runtime \"k8s\" needs the node";
|
||||
ok =
|
||||
|
|
|
|||
Loading…
Reference in a new issue