bind health listeners to the pod's loopback and probe them by exec
This commit is contained in:
parent
b7a8410769
commit
62cc95671d
1 changed files with 255 additions and 185 deletions
|
|
@ -31,7 +31,11 @@ let
|
|||
networkCfg = hyperhiveCfg.network;
|
||||
k8sCfg = hyperhiveCfg.k8s;
|
||||
baoCfg = hyperhiveCfg.swarm.bao;
|
||||
inherit (import ../images { inherit pkgs lib; }) mkServiceImage;
|
||||
inherit (import ../images { inherit pkgs lib; })
|
||||
mkServiceImage
|
||||
wgetOnly
|
||||
loopbackProbe
|
||||
;
|
||||
storeAuth = import ./lib/store-auth.nix;
|
||||
|
||||
# The workloads, as the cluster names them: the store, and the one pod that
|
||||
|
|
@ -254,13 +258,7 @@ let
|
|||
name = grafanaAuthService;
|
||||
package = deployCfg.victoriametrics.authPackage;
|
||||
bin = "swarm-metrics-auth";
|
||||
};
|
||||
probe = path: {
|
||||
httpGet = {
|
||||
inherit path;
|
||||
port = "grafana-health";
|
||||
};
|
||||
periodSeconds = 10;
|
||||
extraContents = [ wgetOnly ];
|
||||
};
|
||||
in
|
||||
{
|
||||
|
|
@ -280,10 +278,10 @@ 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` and `health`: a Service resolves a named port to the first
|
||||
# Not `api`: a Service resolves a named port to the first
|
||||
# container of the pod that declares the name, which is the agents'
|
||||
# responder's.
|
||||
ports = [
|
||||
|
|
@ -291,13 +289,9 @@ let
|
|||
name = "grafana-api";
|
||||
containerPort = grafanaAuthPort;
|
||||
}
|
||||
{
|
||||
name = "grafana-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 [
|
||||
|
|
|
|||
Loading…
Reference in a new issue