Watch
0
0
Fork
You've already forked hyperhive
0

run grafana as a pod in the cluster

The Deployment swarm-grafana replaces the swarm-grafana container: one
replica on a static local volume that is the container's data directory,
an init container that fetches the OIDC client secret and creates the
administrator password, the datasources' bearer and the encryption key in
the secret store, and a sidecar that keeps the controller's Viewer token.
The datasources reach the stores through the gateway with that bearer, and
Grafana's /metrics asks for the stores' kind of credential, which the vhost
sends. The five host units, the journal forwarder, its client glue and the
unix-socket directory go with the container.
This commit is contained in:
atlas 2026-11-27 22:51:25 +01:00
commit 9f62e71dae

View file

@ -1,10 +1,10 @@
# The listener credentials of the Victoria stores the cluster runs and of the
# queue's exporter: the unit that creates each in the swarm secret store when it
# The listener credentials of the Victoria stores and Grafana the cluster runs and
# of the queue's exporter: the unit that creates each in the swarm secret store when it
# holds none, hands it to the gateway's nginx and publishes it to the cluster as
# the Secret the pod reads it from (the store's password, the exporter's bcrypt
# hash). The stores' flags and the locations that send the credential are in
# ../swarm-victorialogs.nix and ../swarm-victoriametrics.nix, the exporter's in
# ../swarm-nats.nix; ../lib/store-auth.nix names what they share.
# hash). The flags and the locations that send the credential are in
# ../swarm-victorialogs.nix, ../swarm-victoriametrics.nix and ../swarm-grafana.nix,
# the exporter's in ../swarm-nats.nix; ../lib/store-auth.nix names what they share.
# docs/4-implementation/k8s/runtime.md has the design.
{
pkgs,
@ -27,10 +27,11 @@ let
# the files `include`d into the store locations.
nginxGroup = config.services.nginx.group;
# The stores this host runs, by the name `store-auth.nix` takes.
# The pods this host runs that take the credential, by the name `store-auth.nix` takes.
stores =
lib.optional deployCfg.victorialogs.enable "victorialogs"
++ lib.optional deployCfg.victoriametrics.enable "victoriametrics";
++ lib.optional deployCfg.victoriametrics.enable "victoriametrics"
++ lib.optional deployCfg.grafana.enable "grafana";
# The queue's exporter runs in the queue's pod.
exporterOn = deployCfg.nats.enable;
@ -96,7 +97,7 @@ in
];
systemd.services.swarm-bao-store-auth = lib.mkIf haveIdentity {
description = "create the Victoria stores' and the queue exporter's listener credentials in the swarm secret store if absent, and publish them";
description = "create the stores', Grafana's and the queue exporter's listener credentials in the swarm secret store if absent, and publish them";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [
@ -216,7 +217,7 @@ in
store_init
store_login
if [ "$STORE_UP" != 1 ]; then
echo "could not log in to the swarm secret store; the stores' credentials are not published." >&2
echo "could not log in to the swarm secret store; the listener credentials are not published." >&2
exit 1
fi
${lib.concatMapStrings publish stores}