swarm-otel, swarm-grafana: a delivery unit fails on no value yet
The collector's and Grafana's OIDC delivery units exited 0 when the store held no value, so systemd did not retry them. On a fresh swarm authelia's mint writes the secret about 30 s after the first read, and only the refresh timer, ten minutes on, read it again. Both units now exit 75, and the store retry they already carry asks every 30 s until the mint lands. Closes #6790
This commit is contained in:
parent
480855dfaf
commit
dad288d555
1 changed files with 88 additions and 22 deletions
|
|
@ -351,6 +351,24 @@ let
|
|||
lib.hasInfix "secret/swarm/services/swarm-grafana/oidc/client" s
|
||||
&& !(lib.hasInfix "secret/swarm/hives/" s);
|
||||
}
|
||||
{
|
||||
# Authelia's mint writes the secret a moment after a fresh swarm's first
|
||||
# boot, so a read that finds nothing yet has to fail and be asked again.
|
||||
# A unit that exits 0 there is done until the refresh timer, ten minutes
|
||||
# on, and Grafana has no login in the meantime.
|
||||
name = "grafana's OIDC delivery unit fails on no value yet, so the store retry asks again";
|
||||
ok =
|
||||
let
|
||||
u = grafanaRemoteAuthelia.systemd.services.swarm-bao-grafana-oidc;
|
||||
afterRead = lib.last (lib.splitString "bao kv get" u.script);
|
||||
beforeWrite = lib.head (lib.splitString "atomic_write_secret" afterRead);
|
||||
in
|
||||
# Both arms: the read that returns nothing and the one that returns an
|
||||
# empty value.
|
||||
lib.length (lib.splitString "exit 75" beforeWrite) == 3
|
||||
&& !(lib.hasInfix "exit 0" beforeWrite)
|
||||
&& u.serviceConfig.Restart == "on-failure";
|
||||
}
|
||||
{
|
||||
# A copy on persistent disk outlives the secret's rotation and lands in
|
||||
# backups of the container's root.
|
||||
|
|
|
|||
Loading…
Reference in a new issue