k8s: the store-credential unit starts at fork, off the boot and switch path
`swarm-bao-store-auth` was a retrying oneshot on multi-user.target. A oneshot's start job stays pending through its restarts, so a boot or a switch with the secret store sealed waited on it for up to 15 minutes, the same shape as #6901's CA publisher. It is now `Type=simple` with the shared retry kept: the start job is done at fork and the unit keeps trying until the store answers. `RemainAfterExit` leaves it `active (exited)` once the credential is out, and the 15-minute start timeout goes, as a start job done at fork has no use for it. Nothing orders after the unit: the gateway reads the file at its next reload and the pods wait in ContainerCreating for the Secret. `is-active` is now true while the script runs and `systemctl restart` returns at fork, so the k8s-services and k8s-nats tests wait for `SubState=exited` where they relied on either. Closes #6937
This commit is contained in:
parent
893b693b46
commit
6a50769269
1 changed files with 80 additions and 7 deletions
|
|
@ -2293,6 +2293,40 @@ let
|
|||
# Without the queue there is no file for it.
|
||||
&& !(lib.elem rule noNode.systemd.tmpfiles.rules);
|
||||
}
|
||||
{
|
||||
# A oneshot's start job stays pending through its restarts, so while the
|
||||
# secret store is sealed a boot and a switch waited on the unit for its
|
||||
# whole retry budget. The start job of a `simple` unit is done at fork.
|
||||
name = "the stores' credential unit starts at fork, so a sealed secret store holds neither multi-user.target nor a switch, and its retries go on";
|
||||
ok =
|
||||
let
|
||||
services = allLocal.systemd.services;
|
||||
unit = services.swarm-bao-store-auth;
|
||||
orderedAfter =
|
||||
name:
|
||||
lib.filterAttrs (
|
||||
_: s: lib.elem name (s.after or [ ]) || lib.elem name (s.requires or [ ])
|
||||
) services;
|
||||
in
|
||||
unit.serviceConfig.Type == "simple"
|
||||
# It is still started at boot, and still restarts on failure for as
|
||||
# long as the store is down: the retry budget is the shared one.
|
||||
&& unit.wantedBy == [ "multi-user.target" ]
|
||||
&& unit.serviceConfig.Restart == "on-failure"
|
||||
&& unit.startLimitBurst == 2880
|
||||
# `active (exited)` after the publish, so `SubState=exited` says the
|
||||
# credential is out.
|
||||
&& unit.serviceConfig.RemainAfterExit
|
||||
# A start timeout would be a second, unrelated budget on a unit whose
|
||||
# start job is done at fork.
|
||||
&& !(unit.serviceConfig ? TimeoutStartSec)
|
||||
# Nothing orders after it, so none of the units that depend on the
|
||||
# credential is delayed by it: the gateway reads the file it writes at
|
||||
# its next reload and the pods wait in `ContainerCreating` for the
|
||||
# Secret. The control: the lookup finds the units ordered after k3s.
|
||||
&& orderedAfter "swarm-bao-store-auth.service" == { }
|
||||
&& orderedAfter "k3s.service" != { };
|
||||
}
|
||||
{
|
||||
# The two `auth_request` responders hold no state and log in under one
|
||||
# role, so they are one pod with one account that may run on any node.
|
||||
|
|
|
|||
Loading…
Reference in a new issue