deploy: move the metrics and log store toggles

Same move as grafana, and the three belong together: they derive from one
switch and a store with no UI is as useless as a UI with no store.

`victorialogs` is the case that shows why the option-path sweep is not
enough on its own. It has **zero** references spelled
`swarm.victorialogs.enable` anywhere in the tree, and four spelled
through `let` aliases (`vlCfg.enable` in the collector, `cfg.enable` in
its own module). A sweep for the path would have reported nothing to do
and left every reader broken.

Prose moved with the code rather than being left behind: the comments in
swarm-required-services.nix that explained why the pair derives together
now sit above the assignments that do it, instead of above the gap where
they used to be.
This commit is contained in:
atlas 2026-08-30 03:19:42 +02:00 committed by mara
commit 29647f963e
9 changed files with 77 additions and 61 deletions

View file

@ -17,6 +17,7 @@
}:
let
cfg = config.services.hyperhive.swarm.victoriametrics;
deployCfg = config.services.hyperhive.deploy;
networkCfg = config.services.hyperhive.network;
hyperhiveCfg = config.services.hyperhive;
gatewayCfg = hyperhiveCfg.gateway;
@ -28,18 +29,10 @@ let
domainBase = if swarmDomain == null then "invalid" else swarmDomain;
in
{
# `enable` moved to `services.hyperhive.deploy.victoriametrics` — see
# ./deploy.nix. What stays here is what the store IS: its package,
# domain, retention and wiring.
options.services.hyperhive.swarm.victoriametrics = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Run the swarm's metrics store on this host. Off by default and not
derived from {option}`services.hyperhive.enable`: a swarm has one
metrics store, so enabling it is a decision about swarm topology
rather than about whether hyperhive is installed.
'';
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.victoriametrics;
@ -97,8 +90,8 @@ in
};
};
config = lib.mkIf (hyperhiveCfg.enable && cfg.enable) {
# The gateway name and the quick-link, both inside `cfg.enable` — that
config = lib.mkIf (hyperhiveCfg.enable && deployCfg.victoriametrics) {
# The gateway name and the quick-link, both inside `deployCfg.victoriametrics` — that
# guard is the load-bearing part. Every hive in a swarm may know this
# store exists, but only the host that RUNS it may claim the name; a
# client hive declaring the vhost would answer for a service it does not