Watch
0
0
Fork
You've already forked hyperhive
0

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:
maia 2026-11-27 21:53:05 +01:00 • committed by maia
commit e8dc0ebac4

View file

@ -416,6 +416,17 @@ pkgs.testers.runNixOSTest {
raise
def store_credential_published() -> None:
# The unit is `Type=simple`: `is-active` is true while its script is still
# running and `systemctl restart` returns at fork, so `SubState=exited`
# is what says the files and the Secrets are out.
settle(
'[ "$(systemctl show --property=SubState --value swarm-bao-store-auth.service)" = exited ]',
900,
["swarm-bao-store-auth.service"],
)
def pods() -> list[str]:
return machine.succeed(f"kubectl -n {NS} get pods --selector app.kubernetes.io/name={SERVICE} -o name || true").split()
@ -849,7 +860,9 @@ pkgs.testers.runNixOSTest {
machine.succeed(f": > {EXPORTER_CONF} && systemctl reload metrics-gateway")
status, _ = gateway_until(401)
assert status == 401, status
machine.succeed("systemctl restart swarm-bao-store-auth.service && systemctl reload metrics-gateway")
machine.succeed("systemctl restart swarm-bao-store-auth.service")
store_credential_published()
machine.succeed("systemctl reload metrics-gateway")
assert gateway_until(200)[0] == 200
with subtest("a leaf that has to be issued again is issued beside the running server, which reloads it for new connections"):