Watch
0
0
Fork
You've already forked hyperhive
0

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:
maia 2026-11-23 12:43:37 +01:00
commit dad288d555

View file

@ -677,8 +677,10 @@ in
#
# Shaped after ./swarm-grafana.nix's store reader: a cert login that fails
# LOUDLY, since every state it fails on is one a retry fixes, then a read
# that degrades QUIETLY, since no retry turns "no value there" into a
# value.
# that fails the same way when the value is not there yet. Authelia's mint
# writes it a moment after a fresh swarm's first boot, so a retry does turn
# "no value there" into a value, and a unit that exited 0 on it would not
# run again until the refresh timer, about ten minutes on.
#
# ⚠️ Renders only where `haveClientIdentity` holds, unlike
# ./swarm-grafana.nix's equivalent unit. That module refuses any host that
@ -740,9 +742,9 @@ in
install -d -m 0700 ${lib.escapeShellArg collectorSecretDir}
# `bao`'s own message is the only thing separating a missing value
# from a refused identity from an unreachable host. This unit's
# degraded mode is correct for all three, so it reports which one
# rather than asserting all three in a sentence of ours.
# from a refused identity from an unreachable host. Retrying is right
# for all three, so this unit reports which one rather than asserting
# all three in a sentence of ours.
err="$(mktemp)"
trap 'rm -f "$err"' EXIT
@ -762,6 +764,9 @@ in
fi
export BAO_TOKEN
# 75 is EX_TEMPFAIL: not there yet, ask again. `Restart=on-failure`
# (./lib/store-retry.nix) asks every 30 s until the mint has written it,
# and the status line says "no value" rather than "no login" (1).
if ! secret="$(bao kv get -field=value ${lib.escapeShellArg storeSecretPath} 2>"$err")"; then
echo "swarm-bao did not return ${storeSecretPath}; the collector has no OIDC client secret yet." >&2
if [ -s "$err" ]; then
@ -769,12 +774,12 @@ in
else
echo "bao failed without writing a diagnostic." >&2
fi
exit 0
exit 75
fi
if [ -z "$secret" ]; then
echo "swarm-bao returned an empty ${storeSecretPath}; leaving the file as it is." >&2
exit 0
exit 75
fi
# root-owned 0400, written with a shell builtin and never handed to a