Watch
0
0
Fork
You've already forked hyperhive
0

bind health listeners to the pod's loopback and probe them by exec

This commit is contained in:
atlas 2026-11-27 23:45:00 +01:00 • committed by maia
commit 9c64b80538

View file

@ -41,7 +41,11 @@ let
hyperhiveCfg = config.services.hyperhive;
gatewayCfg = hyperhiveCfg.gateway;
k8sCfg = hyperhiveCfg.k8s;
inherit (import ../images { inherit pkgs lib; }) mkServiceImage;
inherit (import ../images { inherit pkgs lib; })
mkServiceImage
wgetOnly
loopbackProbe
;
storeAuth = import ./lib/store-auth.nix;
# Copy of `swarm-ui.nix`'s own `swarmAuthRequest` — not shared code because
@ -199,13 +203,7 @@ let
name = grafanaAuthService;
package = deployCfg.victorialogs.grafanaAuthPackage;
bin = "swarm-metrics-auth";
};
probe = path: {
httpGet = {
inherit path;
port = "health";
};
periodSeconds = 10;
extraContents = [ wgetOnly ];
};
in
{
@ -225,7 +223,7 @@ let
env = lib.mapAttrsToList (name: value: { inherit name value; }) (
lib.filterAttrs (n: _: lib.hasPrefix "BAO_" n) env
// {
SWARM_METRICS_AUTH_HEALTH_ADDR = "0.0.0.0:${toString grafanaAuthHealthPort}";
SWARM_METRICS_AUTH_HEALTH_ADDR = "127.0.0.1:${toString grafanaAuthHealthPort}";
}
);
# Not `api`: a Service resolves a named port to the first container of the
@ -235,13 +233,9 @@ let
name = "grafana-api";
containerPort = grafanaAuthPort;
}
{
name = "health";
containerPort = grafanaAuthHealthPort;
}
];
livenessProbe = probe "/healthz";
readinessProbe = probe "/readyz";
livenessProbe = loopbackProbe grafanaAuthHealthPort "/healthz";
readinessProbe = loopbackProbe grafanaAuthHealthPort "/readyz";
volumeMounts = lib.filter (
m:
lib.elem m.name [