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:
parent
a4e44645a0
commit
02e0aab3b6
1 changed files with 46 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue