ship the cache's init units' journal from a host with no collector, with the cache's own client
This commit is contained in:
parent
5e5ff64b3c
commit
a3682a5e9a
1 changed files with 137 additions and 7 deletions
|
|
@ -119,6 +119,14 @@ let
|
|||
prefix = "archive";
|
||||
};
|
||||
};
|
||||
# The cache by hand on a host with neither the hive collector nor the swarm
|
||||
# collector: the one place its init units' journal has no collector to go
|
||||
# through.
|
||||
atticAlone = hive {
|
||||
deploy.bao.enable = true;
|
||||
deploy.attic.enable = true;
|
||||
};
|
||||
forwarderOf = m: m.services.hyperhive.swarmJournalForwarder;
|
||||
atticWarnings =
|
||||
m:
|
||||
lib.length (
|
||||
|
|
@ -494,6 +502,60 @@ let
|
|||
&& hasNone atticExternal
|
||||
&& lib.elem "hive-c0re.service" (units atticByHand);
|
||||
}
|
||||
{
|
||||
# With neither collector the init units' journal would ship nowhere, so
|
||||
# the host runs the forwarder module itself, for those two units only,
|
||||
# to the cache's own route as the cache's own client. `atticByHand` (hive
|
||||
# collector) and `atticHere` (swarm collector) are the controls: their
|
||||
# journal already goes through a collector, so a second forwarder would
|
||||
# send each line twice.
|
||||
name = "a host with no collector forwards the cache's init units itself, and a host with one does not";
|
||||
ok =
|
||||
let
|
||||
f = forwarderOf atticAlone;
|
||||
settings = atticAlone.services.opentelemetry-collector.settings;
|
||||
svcs = atticAlone.systemd.services;
|
||||
in
|
||||
f.enable
|
||||
&&
|
||||
f.units == [
|
||||
"swarm-bao-attic-secret.service"
|
||||
"swarm-bao-attic-tokens.service"
|
||||
]
|
||||
&& settings.receivers.journald.units == f.units
|
||||
&& settings.receivers.journald.directory == "/var/log/journal"
|
||||
&& f.clientId == "swarm-attic-collector"
|
||||
&& f.endpoint == "https://${atticAlone.services.hyperhive.swarm.otel.domain}/swarm-attic";
|
||||
}
|
||||
{
|
||||
# The control for the case above: the same lookups find the forwarder on
|
||||
# the host that needs it and none where a collector already ships.
|
||||
name = "the host's cache forwarder is absent where the hive or the swarm collector ships the journal";
|
||||
ok =
|
||||
(forwarderOf atticAlone).enable
|
||||
&& !(forwarderOf atticByHand).enable
|
||||
&& !(forwarderOf atticHere).enable
|
||||
&& !(atticByHand.systemd.services ? swarm-journal-forwarder-oidc)
|
||||
&& !(atticHere.systemd.services ? swarm-journal-forwarder-oidc)
|
||||
&& atticAlone.systemd.services ? swarm-journal-forwarder-oidc;
|
||||
}
|
||||
{
|
||||
# The forwarder logs in with the cache's leaf and reads the cache's own
|
||||
# client secret, the path the container's forwarder reads, so no grant and
|
||||
# no client is new. The container's receiver ships its whole journal.
|
||||
name = "the host's cache forwarder uses the cache's leaf and client, and the container still ships its whole journal";
|
||||
ok =
|
||||
let
|
||||
env = atticAlone.systemd.services.swarm-journal-forwarder-oidc.environment;
|
||||
inner = atticAlone.containers.swarm-attic.config.services.opentelemetry-collector.settings;
|
||||
in
|
||||
env.BAO_CLIENT_CERT == "/var/lib/swarm-bao-pki/attic.pem"
|
||||
&& env.BAO_CLIENT_KEY == "/var/lib/swarm-bao-pki/attic-key.pem"
|
||||
&&
|
||||
(forwarderOf atticAlone).store.secretPath
|
||||
== "secret/swarm/services/swarm-attic-collector/oidc/client"
|
||||
&& !(inner.receivers.journald ? units);
|
||||
}
|
||||
{
|
||||
# The hive collector ships the container units' start output (the rootfs
|
||||
# check's lines) unless the swarm collector already reads the whole
|
||||
|
|
|
|||
Loading…
Reference in a new issue