From 448c3bf1b360709ede4c92dc00655e76ad056234 Mon Sep 17 00:00:00 2001 From: atlas Date: Fri, 27 Nov 2026 23:33:30 +0100 Subject: [PATCH] k8s-node asserts the poller's CronJob and default-deny policy in the hyperhive namespace, which the cluster now holds --- nix/vm-tests/k8s-node.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nix/vm-tests/k8s-node.nix b/nix/vm-tests/k8s-node.nix index efc39f448..180fddc75 100644 --- a/nix/vm-tests/k8s-node.nix +++ b/nix/vm-tests/k8s-node.nix @@ -8,8 +8,9 @@ # the module loads (`system.build.k8sImages`); # - the cluster encrypts its Secrets, runs CoreDNS, and runs neither traefik # nor metrics-server; -# - the cluster holds no hyperhive workload: its namespace does not exist and -# no pod runs one of the images; +# - the cluster's only hyperhive workload is the poller's CronJob, with the +# namespace's default-deny ingress policy, and no pod runs one of the images +# under the hive's own name; # - the node takes pod and service addresses from the module's ranges and the # hive bridge keeps its own, so the two do not share a subnet; # - the firewall trusts `cni0`, and still guards the other interfaces; @@ -188,8 +189,17 @@ pkgs.testers.runNixOSTest { for name in ["traefik", "metrics-server"]: assert f"deployment.apps/{name}" not in deployments, deployments - with subtest("the cluster holds no hyperhive workload"): - machine.fail("kubectl get namespace hyperhive") + with subtest("the cluster's only hyperhive workload is the poller's CronJob, behind the default-deny policy"): + # k3s applies the manifests once it is Ready, the CronJob's file after + # the namespace's. + machine.wait_until_succeeds( + "kubectl -n hyperhive get cronjob/swarm-ci-metrics networkpolicy/default-deny-ingress", timeout=120 + ) + names = kube(machine, "-n hyperhive get cronjob,deployment,statefulset,daemonset,networkpolicy -o name").split() + assert sorted(names) == [ + "cronjob.batch/swarm-ci-metrics", + "networkpolicy.networking.k8s.io/default-deny-ingress", + ], names pods = json.loads(kube(machine, "get pods -A -o json"))["items"] images = [c["image"] for p in pods for c in p["spec"]["containers"]] assert images, "no pod runs: the lookup finds nothing"