swarm-ci-runner, swarm-grafana, swarm-victorialogs: forward each container's journal to the swarm collector
Each container now runs the journal forwarder the queue's and the builder's containers run, pushing to a receiver of its own on the swarm collector. Each authenticates as a new machine OIDC client of its own (swarm.<service>.otel.clientId), registered by a glue file wherever authelia runs, minted by authelia and published to the store by the secret publisher. Grafana's browser login client is unchanged. The fetch unit inside each container reads the client secret with the store identity the host already holds for that service (the runner's, Grafana's, and the log store responder's), now also handed into the container as an nspawn system credential. Each of those three policies gains one read stanza on its forwarder's client path. The host units that use those identities are unchanged. The three containers drop --link-journal=host, and the host collector stops reading them.
This commit is contained in:
parent
c5dbab3277
commit
c6ca9ab845
20 changed files with 810 additions and 107 deletions
|
|
@ -492,6 +492,51 @@ let
|
|||
forgeSettings.service.DISABLE_REGISTRATION == true
|
||||
&& !(forgeSettings.service.ALLOW_ONLY_INTERNAL_REGISTRATION or false);
|
||||
}
|
||||
{
|
||||
# The runner's own store leaf, handed in as system credentials, reads the
|
||||
# forwarder's client secret; the host's token fetch keeps the same files.
|
||||
name = "the CI runner container forwards its journal to its own route as its own client";
|
||||
ok =
|
||||
let
|
||||
h = ciAlone;
|
||||
container = h.containers.swarm-ci-runner;
|
||||
c = container.config;
|
||||
s = c.services.opentelemetry-collector.settings;
|
||||
fetch = c.systemd.services.swarm-journal-forwarder-oidc;
|
||||
clientId = h.services.hyperhive.swarm.ci-runner.otel.clientId;
|
||||
dir = "/run/credentials/swarm-journal-forwarder-oidc.service";
|
||||
in
|
||||
c.services.opentelemetry-collector.enable
|
||||
&&
|
||||
s.exporters.otlphttp.endpoint == "https://${h.services.hyperhive.swarm.otel.domain}/swarm-ci-runner"
|
||||
&& s.extensions."oauth2client/swarm".client_id == clientId
|
||||
&& s.extensions."oauth2client/swarm".endpoint_params.audience == clientId
|
||||
&& h.services.hyperhive.swarm.otel.serviceProducers.swarm-ci-runner.clientId == clientId
|
||||
&&
|
||||
(lib.findFirst (a: a.key == "service.name") null s.processors.resource.attributes).value
|
||||
== "ci-runner"
|
||||
&& fetch.environment.BAO_CLIENT_CERT == "${dir}/ci-runner-bao-cert"
|
||||
&& fetch.environment.BAO_CLIENT_KEY == "${dir}/ci-runner-bao-key"
|
||||
&& lib.elem "ci-runner-bao-cert" fetch.serviceConfig.LoadCredential
|
||||
&& lib.elem "ci-runner-bao-key" fetch.serviceConfig.LoadCredential
|
||||
&& lib.hasInfix "bao kv get -field=value secret/swarm/services/${clientId}/oidc/client" fetch.script
|
||||
&& !(lib.elem "--link-journal=host" container.extraFlags)
|
||||
&& lib.elem "--load-credential=ci-runner-bao-cert:/etc/pki/bao-ci-runner.pem" container.extraFlags
|
||||
&& lib.elem "--load-credential=ci-runner-bao-key:/etc/pki/bao-ci-runner-key.pem" container.extraFlags
|
||||
&&
|
||||
h.systemd.services.swarm-bao-ci-runner.environment.BAO_CLIENT_CERT == "/etc/pki/bao-ci-runner.pem";
|
||||
}
|
||||
{
|
||||
name = "the CI runner forwarder's metrics port is loopback";
|
||||
ok =
|
||||
let
|
||||
c = ciAlone.containers.swarm-ci-runner.config;
|
||||
reader = lib.head c.services.opentelemetry-collector.settings.service.telemetry.metrics.readers;
|
||||
in
|
||||
c.services.hyperhive.swarmJournalForwarder.telemetryPort == 8895
|
||||
&& reader.pull.exporter.prometheus.host == "127.0.0.1"
|
||||
&& reader.pull.exporter.prometheus.port == 8895;
|
||||
}
|
||||
];
|
||||
in
|
||||
runGroup "forge-placement" cases
|
||||
|
|
|
|||
Loading…
Reference in a new issue