deploy: separate "what this host deploys" from swarm-wide truth

`services.hyperhive.swarm.*` is meant to be identical on every host in a
swarm — it describes the swarm, and every hive needs all of it to be a
client. But it also carried the `enable` toggles, which are precisely the
values that must differ per machine. The namespace that should be the
same everywhere held the one thing that cannot be.

Adds `services.hyperhive.deploy.*` for a host's deployment decisions, and
moves the first of them (`swarm.grafana.enable` -> `deploy.grafana`) as
the pattern for the rest. Flat and named for the thing deployed rather
than grouped under a "swarm services" attribute: from the deploy side it
does not matter what kind of thing each one is, and a grouping by service
kind would re-encode the service-side taxonomy into a layer that does not
care about it.

Behaviour is unchanged. The move is a rename in the strict sense — same
type, same meaning, new path — so `mkRenamedOptionModule` carries it and
existing configs keep evaluating with one warning naming both paths. The
renames live in the new module rather than the service modules, so the
whole migration has a single home and a single file to delete when the
deprecation window closes.
This commit is contained in:
atlas 2026-08-30 03:08:18 +02:00 committed by mara
commit b422367942
6 changed files with 73 additions and 16 deletions

View file

@ -69,7 +69,8 @@ in
# takes one and not the other from this switch. An operator who wants
# exactly one still sets it directly, which `mkDefault` allows.
victoriametrics.enable = lib.mkDefault swarmCfg.enableRequiredServices;
grafana.enable = lib.mkDefault swarmCfg.enableRequiredServices;
# (grafana's half of the pair derives below — it lives in `deploy.*`
# now, which is a different attribute path, not a different rule.)
# The log store, deriving from the same switch for the same reason —
# and deliberately in the same commit as the collector pipeline that
@ -88,4 +89,10 @@ in
# The collector that feeds the pair above (note: no `swarm.` prefix,
# this is ./otel.nix's existing per-hive option).
config.services.hyperhive.otel.enable = lib.mkDefault swarmCfg.enableRequiredServices;
# Grafana, the UI half of the metrics pair. Same derivation and the same
# reasoning as `victoriametrics.enable` above; it reads differently only
# because "does this host run it" now lives in `deploy.*` (./deploy.nix)
# rather than under `swarm.*`, which has to be identical on every host.
config.services.hyperhive.deploy.grafana = lib.mkDefault swarmCfg.enableRequiredServices;
}