Watch
0
0
Fork
You've already forked hyperhive
0

ship the cache host init units' journal through the hive collector

This commit is contained in:
atlas 2026-10-27 21:53:38 +01:00 • committed by mara
commit 28be594f79

View file

@ -95,7 +95,7 @@ let
atticVhost = atticHere.services.hyperhive.gateway.vhosts."attic.t.local";
# The cache switched on while the operator overrides the options.
atticByHand = hive {
atticByHand = hiveWithController {
deploy.bao.enable = true;
deploy.attic.enable = true;
swarm.attic.domain = "cache.example.org";
@ -388,6 +388,33 @@ let
&& atticHere.systemd.services ? swarm-bao-attic-secret
&& atticHere.systemd.services ? swarm-bao-attic-tokens;
}
{
# The hive collector's journal allow-list carries the cache's init units
# on a hive host with the cache and no swarm collector (`atticByHand`).
# Where the swarm collector runs too (`atticHere`) it reads the whole
# journal, so the units are not named twice; without the cache
# (`atticExternal`) they are absent. `hive-c0re.service` is the control
# that each list is the one the collector reads.
name = "the hive collector ships the cache's init units only where nothing else reads the host journal";
ok =
let
units = m: m.services.opentelemetry-collector.settings.receivers.journald.units;
initUnits = [
"swarm-bao-attic-secret.service"
"swarm-bao-attic-tokens.service"
];
has = m: lib.all (u: lib.elem u (units m)) initUnits;
hasNone = m: lib.all (u: !(lib.elem u (units m))) initUnits;
in
has atticByHand
&& hasNone atticHere
&& hasNone atticExternal
&& lib.all (m: lib.elem "hive-c0re.service" (units m)) [
atticByHand
atticHere
atticExternal
];
}
{
# Both host units log in as the cache's principal, not the hive's, and
# the container reaches the key through a read-only directory. The