refactor(nix): make all-local a deployment mode, not a default
mara: enableAllLocalDefaults is more of a deployment mode via settings set, less a default setting. That reframing is the change. A mode asserts values; an option declares what it is when nobody asks. Written as default = <flag>, every service option had to name a switch it has no relationship to, and the answer to what does all-local turn on was spread across five files. Two modules now hold the two tiers - local-defaults.nix for the mode and what it asserts directly, swarm-required-services.nix for the services-live-here switch and the per-service enables under it. Each service module keeps its own declaration and loses only the line about when a deployment wants it. mkDefault is the right precedence rather than a compromise: it beats an option default and yields to any explicit definition, so the mode fills in for an operator who has not spoken and never argues with one who has. Evaluated config is unchanged in both directions.
This commit is contained in:
parent
01680ee962
commit
048bdd29a8
8 changed files with 134 additions and 79 deletions
|
|
@ -52,18 +52,15 @@ in
|
|||
options.services.hyperhive.swarm.ca = {
|
||||
autoConfigure = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = hyperhiveCfg.enableAllLocalDefaults;
|
||||
defaultText = lib.literalExpression "services.hyperhive.enableAllLocalDefaults";
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Run the whole swarm CA on this one host: generate the swarm
|
||||
root when it is missing, and issue this hive's CA under it.
|
||||
|
||||
Defaults from `services.hyperhive.enableAllLocalDefaults`, the
|
||||
all-on-one-box switch — which is off, so this is off, and the
|
||||
paragraph below still describes what a hive does by default.
|
||||
Set it directly to run the CA on a host that is not otherwise
|
||||
all-local.
|
||||
`services.hyperhive.enableAllLocalDefaults` turns this on as
|
||||
part of the all-on-one-box mode. Set it here directly to run the
|
||||
CA on a host that is not otherwise all-local.
|
||||
|
||||
**Off by default, deliberately.** A swarm's services and its
|
||||
hives can live on different hosts, and this host has no way to
|
||||
|
|
|
|||
Loading…
Reference in a new issue