Watch
0
0
Fork
You've already forked hyperhive
0

move the c0re host options to deploy.hive-controller

This commit is contained in:
atlas 2026-10-29 01:02:45 +01:00
commit 74f463c40e

View file

@ -280,7 +280,7 @@ let
settings = builtins.fromJSON allLocal.systemd.services.swarm-controller.environment.SWARM_CONTROLLER_META_FLAKE;
in
settings ? hyperhive_rev
&& settings.hyperhive_rev == allLocal.services.hyperhive.c0re.hyperhiveRev
&& settings.hyperhive_rev == allLocal.services.hyperhive.deploy.hive-controller.hyperhiveRev
&& settings ? git_base;
}
{
@ -1412,6 +1412,106 @@ let
&& warned old
&& !(warned bare);
}
{
# Every c0re option that moved under `deploy.hive-controller` still
# takes its old spelling, with one rename warning each, and lands at
# the new path. The packages are distinct stand-ins so a crossed
# forward shows. `bare` is the control that the warning is not always
# present, and the new path is what the rendered values below read.
name = "services.hyperhive.c0re.* options that moved still set deploy.hive-controller.*, with rename warnings";
ok =
let
old = hiveWithController {
c0re.package = pkgs.hello;
c0re.frontend = pkgs.coreutils;
c0re.assets = pkgs.gnused;
c0re.xdgIcons = pkgs.gnugrep;
c0re.agentBaseToplevel = pkgs.findutils;
c0re.hyperhiveRev = "abc123";
c0re.preBuildAgentTemplates = true;
c0re.modelPrices.sonnet = {
input = 1.0;
output = 2.0;
cache_read = 3.0;
cache_write = 4.0;
};
c0re.agentCpuQuota = "300%";
c0re.agentMemoryMax = "8G";
c0re.agentCpuWeight = 50;
c0re.agentIoWeight = null;
c0re.buildSlots = 3;
c0re.adminUsers = [ "alice" ];
};
c = old.services.hyperhive.deploy.hive-controller;
warned =
m: name:
lib.any (
w: lib.hasInfix "services.hyperhive.c0re.${name}" w && lib.hasInfix "has been renamed" w
) m.warnings;
serve = builtins.fromJSON (
builtins.unsafeDiscardStringContext old.environment.etc."hyperhive/serve.json".text
);
path = p: builtins.unsafeDiscardStringContext "${p}";
in
path c.package == path pkgs.hello
&& path c.frontend == path pkgs.coreutils
&& path c.assets == path pkgs.gnused
&& path c.xdgIcons == path pkgs.gnugrep
&& path c.agentBaseToplevel == path pkgs.findutils
&& path c.servedFrontend == path pkgs.coreutils
&& c.hyperhiveRev == "abc123"
&& c.preBuildAgentTemplates
&& c.modelPrices.sonnet.cache_write == 4.0
&& c.agentCpuQuota == "300%"
&& c.agentMemoryMax == "8G"
&& c.agentCpuWeight == 50
&& c.agentIoWeight == null
&& c.buildSlots == 3
&& c.adminUsers == [ "alice" ]
&& lib.all (warned old) [
"package"
"frontend"
"assets"
"xdgIcons"
"agentBaseToplevel"
"hyperhiveRev"
"preBuildAgentTemplates"
"modelPrices"
"agentCpuQuota"
"agentMemoryMax"
"agentCpuWeight"
"agentIoWeight"
"buildSlots"
"adminUsers"
]
&& !(warned bare "package")
&& !(warned bare "adminUsers")
&& serve.agent_memory_max == "8G"
&& serve.agent_cpu_quota == "300%"
&& serve.build_slots == 3
&& old.users.groups.hive-admin.members == [ "alice" ];
}
{
# What the moved options render with their defaults: the agent limits
# and build slots in serve.json, the sudoless-hivectl group's members,
# and the model price table. The same values the options held at their
# old paths.
name = "the agent limits, build slots, admin group and price table render their defaults unchanged";
ok =
let
serve = builtins.fromJSON (
builtins.unsafeDiscardStringContext allLocal.environment.etc."hyperhive/serve.json".text
);
in
serve.agent_memory_max == "4G"
&& serve.agent_cpu_quota == "200%"
&& serve.agent_cpu_weight == 80
&& serve.agent_io_weight == 80
&& serve.build_slots == 1
&& serve.model_prices.opus.input == 5.0
&& serve.model_prices.haiku.cache_write == 2.0
&& allLocal.users.groups.hive-admin.members == [ ];
}
{
# A hive's rendered identity, pinned so moving the option changes none of
# it: the coordinator's name and client, the dashboard name, the CN of the
@ -1526,7 +1626,7 @@ let
carries =
m: name:
checks m name == [
(builtins.unsafeDiscardStringContext "-${m.services.hyperhive.c0re.package}/bin/hive-priv check-rootfs --warn-only ${name}")
(builtins.unsafeDiscardStringContext "-${m.services.hyperhive.deploy.hive-controller.package}/bin/hive-priv check-rootfs --warn-only ${name}")
];
names = lib.attrNames allLocal.containers;
in