Watch
0
0
Fork
You've already forked hyperhive
0

swarm-bao granter stops retrying a rejected bootstrap token

swarm-bao-granter-role exits 4 when the store is unsealed but refuses the
bootstrap token, and Restart=on-failure retried that every 30s for as long
as the token file existed. RestartPreventExitStatus=4 makes that permanent
failure leave the unit failed once. Exit 1 (store sealed or unreachable)
keeps retrying.

On deploy: the unit goes red once instead of looping every 30s. The stale
token on muede-lpt2 still needs the operator step (remove it or mint a
fresh one); this does not clear it.
This commit is contained in:
atlas 2026-10-21 01:25:19 +02:00 • committed by mara
commit 9a65643769
3 changed files with 18 additions and 0 deletions

View file

@ -40,6 +40,11 @@ the bootstrap commands. It never skips. `swarm-bao-granter-role` skips while
the token file is absent, which is the steady state afterwards; the token's the token file is absent, which is the steady state afterwards; the token's
TTL means a forgotten file expires rather than lingering. TTL means a forgotten file expires rather than lingering.
A sealed or unreachable store makes the unit retry every 30 s. A store that
refuses the token (expired, revoked, or missing the `bao-bootstrap` policy)
makes it exit 4 and stay `failed` with the one-time step in its log; mint a
fresh token or remove the file, then restart it.
After that, a new or changed `swarm-*` grant needs no operator step: the unit After that, a new or changed `swarm-*` grant needs no operator step: the unit
that writes it changes, and the deploy restarts it. A root step comes back only that writes it changes, and the deploy restarts it. A root step comes back only
when the granter itself needs a path it lacks, such as a new mount. when the granter itself needs a path it lacks, such as a new mount.

View file

@ -3135,6 +3135,9 @@ in
RemainAfterExit = true; RemainAfterExit = true;
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 30; RestartSec = 30;
# Exit 4 is a refused bootstrap token, which retrying cannot fix:
# the unit stays failed until the operator replaces the token.
RestartPreventExitStatus = "4";
TimeoutStartSec = 60; TimeoutStartSec = 60;
# Runs only once the script above exits 0, which is when the # Runs only once the script above exits 0, which is when the
# granter may first configure `auth/oidc`; the viewer unit exits 0 # granter may first configure `auth/oidc`; the viewer unit exits 0

View file

@ -1154,6 +1154,16 @@ let
&& u.serviceConfig.Restart == "on-failure" && u.serviceConfig.Restart == "on-failure"
) grantingUnitNames; ) grantingUnitNames;
} }
{
# Exit 4 is the refused-token path, which no retry can fix; exit 1 (store
# sealed or unreachable) stays retried.
name = "the granter's unit stays failed on exit 4 and retries other failures";
ok =
let
sc = baoGrantHere.systemd.services.swarm-bao-granter-role.serviceConfig;
in
sc.RestartPreventExitStatus == "4" && sc.Restart == "on-failure";
}
{ {
# Every reader and granting unit's start pulls the PKI unit in, so a mass # Every reader and granting unit's start pulls the PKI unit in, so a mass
# container start outruns systemd's default limit of 5 starts in 10s. # container start outruns systemd's default limit of 5 starts in 10s.