Watch
0
0
Fork
You've already forked hyperhive
0

run the metrics store and its auth responders as pods

This commit is contained in:
atlas 2026-11-27 09:11:27 +01:00 • committed by maia
commit 07a004fad1
2 changed files with 1308 additions and 1031 deletions

View file

@ -130,13 +130,19 @@ let
"nats"
"swarm-controller"
"victorialogs"
"victoriametrics"
];
enabledServices = lib.filter (name: deployCfg.${name}.enable) swarmServices;
# The services whose data the module keeps in the cluster. Each puts its state
# label on this node.
stateful = lib.filterAttrs (_: svc: svc.enable) {
inherit (deployCfg) nats ci-metrics victorialogs;
inherit (deployCfg)
nats
ci-metrics
victorialogs
victoriametrics
;
};
in
{
@ -265,7 +271,7 @@ in
none of those pods.
- `hyperhive.darkest.space/state-<service>` for each service whose data the
cluster keeps: `nats`, `ci-metrics` and `victorialogs`, each when enabled. A volume's `nodeAffinity` and the pod's `nodeSelector` name it.
cluster keeps: `nats`, `ci-metrics`, `victorialogs` and `victoriametrics`, each when enabled. A volume's `nodeAffinity` and the pod's `nodeSelector` name it.
- `hyperhive.darkest.space/entry`: the node the hosts' DNS points at.
- `svccontroller.k3s.cattle.io/enablelb`: with it on any node, the
service load balancer binds a published port on the labelled nodes

View file

@ -135,7 +135,8 @@ let
# service has one, is the TCP port a Service publishes and the directory the
# pod's init container writes the leaf to; without a `tlsDir` it is plain HTTP
# and no leaf is issued. `probe` is the path a service without a `healthEnv` is
# probed on, and `fsGroupChangePolicy` the pod's setting of that name.
# probed on (with `startupFailureThreshold`, a startup probe of that many
# ten-second tries first), and `fsGroupChangePolicy` the pod's setting of that name.
# `ephemeralState` gives a service an `emptyDir` in place of a claim for its
# state directory: what it keeps there is re-derived at start. A pod starts on
# whatever volume it gets.
@ -295,6 +296,49 @@ let
egress = [ "store" ];
otlp = "none";
};
# The metrics store: the VictoriaMetrics daemon alone, on a static local
# volume on the store's data directory. It holds no store
# identity and pushes no telemetry; its own `/metrics` is scraped through
# the gateway. It opens its storage before it serves HTTP, so the pod has a
# startup probe that outlasts a large store's open.
swarm-victoriametrics = {
inherit (deployCfg.victoriametrics) enable package unit;
daemon = "victoria-metrics";
kind = "Deployment";
healthEnv = null;
probe = {
path = "/health";
startupFailureThreshold = 60;
};
etcFiles = [ ];
publicCredentials = { };
listener.port = deployCfg.victoriametrics.servicePort;
localState = {
service = "victoriametrics";
hostDir = deployCfg.victoriametrics.hostDataDir;
};
fsGroupChangePolicy = "OnRootMismatch";
otlp = "none";
};
# The two `auth_request` responders of the metrics store's gateway vhost,
# which log in to the secret store under one role. They keep no state, so
# they run on any node. The Grafana responder is the second container of the
# pod, in `pod`; the first is the `swarm-logs-auth` binary on the metrics
# surface.
swarm-metrics-auth = {
inherit (deployCfg.victoriametrics) enable;
package = deployCfg.victoriametrics.agentAuthPackage;
daemon = "swarm-logs-auth";
unit = deployCfg.victoriametrics.authUnit;
inherit (deployCfg.victoriametrics) pod;
kind = "Deployment";
healthEnv = "SWARM_LOGS_AUTH_HEALTH_ADDR";
etcFiles = [ ];
publicCredentials."bao-ca.pem" = baoServerCaKey;
listener.port = deployCfg.victoriametrics.authServicePort;
egress = [ "store" ];
otlp = "none";
};
};
# Where a pod pushes telemetry. A `"hive"` service pushes to the hive
@ -902,6 +946,17 @@ let
periodSeconds = 10;
};
}
# The liveness and readiness probes wait for this one to succeed once.
// lib.optionalAttrs (svc.probe.startupFailureThreshold or null != null) {
startupProbe = {
httpGet = {
inherit (svc.probe) path;
port = "api";
};
periodSeconds = 10;
failureThreshold = svc.probe.startupFailureThreshold;
};
}
// lib.optionalAttrs (svc.healthEnv != null) {
livenessProbe = {
httpGet = {