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:
parent
9a01906275
commit
b422367942
6 changed files with 73 additions and 16 deletions
|
|
@ -16,6 +16,7 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.services.hyperhive.swarm.grafana;
|
||||
deployCfg = config.services.hyperhive.deploy;
|
||||
networkCfg = config.services.hyperhive.network;
|
||||
hyperhiveCfg = config.services.hyperhive;
|
||||
gatewayCfg = hyperhiveCfg.gateway;
|
||||
|
|
@ -106,18 +107,12 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
# `enable` moved to `services.hyperhive.deploy.grafana` — see
|
||||
# ./deploy.nix. Whether this host runs the swarm's Grafana is a
|
||||
# deployment decision, and `swarm.*` has to be identical on every host.
|
||||
# What stays here is what the service IS: its package, domain, and
|
||||
# wiring.
|
||||
options.services.hyperhive.swarm.grafana = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Run the swarm's metrics UI on this host. Off by default and not
|
||||
derived from {option}`services.hyperhive.enable`: a swarm has one
|
||||
Grafana, 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.grafana;
|
||||
|
|
@ -312,8 +307,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.grafana) {
|
||||
# The gateway name and the quick-link, both inside `deploy.grafana` — that
|
||||
# guard is the load-bearing part. Every hive in a swarm may know this UI
|
||||
# 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 have.
|
||||
|
|
|
|||
Loading…
Reference in a new issue