1 import ../make-test-python.nix (
9 pauseImage = pkgs.dockerTools.streamLayeredImage {
10 name = "test.local/pause";
12 contents = pkgs.buildEnv {
13 name = "rke2-pause-image-env";
27 testPodYaml = pkgs.writeText "test.yaml" ''
35 image: test.local/pause:local
36 imagePullPolicy: Never
37 command: ["sh", "-c", "sleep inf"]
41 name = "${rke2.name}-single-node";
42 meta.maintainers = rke2.meta.maintainers;
47 networking.firewall.enable = false;
48 networking.useDHCP = false;
49 networking.defaultGateway = "192.168.1.1";
50 networking.interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [
52 address = "192.168.1.1";
57 virtualisation.memorySize = 1536;
58 virtualisation.diskSize = 4096;
64 nodeIP = "192.168.1.1";
78 kubectl = "${pkgs.kubectl}/bin/kubectl --kubeconfig=/etc/rancher/rke2/rke2.yaml";
79 ctr = "${pkgs.containerd}/bin/ctr -a /run/k3s/containerd/containerd.sock";
84 machine.wait_for_unit("rke2")
85 machine.succeed("${kubectl} cluster-info")
86 machine.wait_until_succeeds(
87 "${pauseImage} | ${ctr} -n k8s.io image import -"
90 machine.wait_until_succeeds("${kubectl} get serviceaccount default")
91 machine.succeed("${kubectl} apply -f ${testPodYaml}")
92 machine.succeed("${kubectl} wait --for 'condition=Ready' pod/test")
93 machine.succeed("${kubectl} delete -f ${testPodYaml}")