Watch
0
0
Fork
You've already forked hyperhive
0

k8s: refuse a workload name that starts with the legacy hive- prefix

The forge and matrix services carry a hive- prefix from their per-hive
container days. Neither runs in the cluster on k8s/v1 yet, so nothing
is renamed here: the renderer now fails the evaluation of any in-cluster
workload that carries a name starting with hive- (an object key, an
object's name, or its app label), so the move cannot bring the prefix
along. A module-eval case pins the lookup on literals and holds the
rendered hosts to it.
This commit is contained in:
maia 2026-11-26 21:17:30 +01:00
commit 02e0aab3b6

View file

@ -2330,6 +2330,31 @@ let
&& !(hasInfix "\"imagePullPolicy\":\"Never\"" clusterText)
&& !(hasInfix "docker.io" clusterText);
}
{
# The literals are the controls that the lookup sees each place a name is
# written (an object key, a name, the app label) and lets `swarm-` and an
# inner `hive-` through. The hosts hold many objects, so the empty result
# is not an empty input.
name = "no workload, Service, volume claim or label in the cluster starts with the legacy hive- prefix";
ok =
let
legacy =
(import ../host-modules/k8s/render.nix {
inherit lib pkgs;
config = onCluster;
}).legacyPrefixed;
obj = name: labels: { metadata = { inherit name labels; }; };
named = n: l: legacy { x = obj n l; };
in
legacy { "hive-forge/deployment" = obj "x" { }; } == [ "hive-forge/deployment" ]
&& named "hive-matrix" { } == [ "hive-matrix" ]
&& named "x" { "app.kubernetes.io/name" = "hive-forge"; } == [ "hive-forge" ]
&& named "swarm-hive-forge" { "app.kubernetes.io/name" = "swarm-x"; } == [ ]
&& lib.length (lib.attrNames objects) >= 15
&& lib.length (lib.attrNames (render onCluster)) >= 30
&& legacy objects == [ ]
&& legacy (render onCluster) == [ ];
}
];
in
runGroup "k8s" cases