diff options
author | Euan Kemp <euank@euank.com> | 2021-10-25 17:43:27 -0700 |
---|---|---|
committer | Euan Kemp <euank@euank.com> | 2021-10-25 17:43:27 -0700 |
commit | 3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc (patch) | |
tree | 3ce9160c9fd28ee0132c44421c317365ba9f4f36 /nixos | |
parent | 83ed4b46fde24845c3157dcf0923210d6423998c (diff) | |
download | nixlib-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar nixlib-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.gz nixlib-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.bz2 nixlib-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.lz nixlib-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.xz nixlib-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.zst nixlib-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.zip |
nixos/tests/k3s: address pr feedback
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/k3s-single-node-docker.nix (renamed from nixos/tests/k3s-docker.nix) | 18 | ||||
-rw-r--r-- | nixos/tests/k3s-single-node.nix (renamed from nixos/tests/k3s.nix) | 18 |
2 files changed, 22 insertions, 14 deletions
diff --git a/nixos/tests/k3s-docker.nix b/nixos/tests/k3s-single-node-docker.nix index 62544e3ee13e..7f3d15788b04 100644 --- a/nixos/tests/k3s-docker.nix +++ b/nixos/tests/k3s-single-node-docker.nix @@ -1,11 +1,14 @@ import ./make-test-python.nix ({ pkgs, ... }: let - # A suitable k3s pause image, also used for the test pod - pauseImage = pkgs.dockerTools.buildImage { + imageEnv = pkgs.buildEnv { + name = "k3s-pause-image-env"; + paths = with pkgs; [ tini (hiPrio coreutils) busybox ]; + }; + pauseImage = pkgs.dockerTools.streamLayeredImage { name = "test.local/pause"; tag = "local"; - contents = with pkgs; [ tini coreutils busybox ]; + contents = imageEnv; config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ]; }; # Don't use the default service account because there's a race where it may @@ -39,8 +42,8 @@ import ./make-test-python.nix ({ pkgs, ... }: environment.systemPackages = with pkgs; [ k3s gzip ]; # k3s uses enough resources the default vm fails. - virtualisation.memorySize = pkgs.lib.mkDefault 1536; - virtualisation.diskSize = pkgs.lib.mkDefault 4096; + virtualisation.memorySize = 1536; + virtualisation.diskSize = 4096; services.k3s = { enable = true; @@ -65,10 +68,11 @@ import ./make-test-python.nix ({ pkgs, ... }: machine.wait_for_unit("k3s") machine.succeed("k3s kubectl cluster-info") machine.fail("sudo -u noprivs k3s kubectl cluster-info") - # machine.succeed("k3s check-config") # fails with the current nixos kernel config, uncomment once this passes + # FIXME: this fails with the current nixos kernel config; once it passes, we should uncomment it + # machine.succeed("k3s check-config") machine.succeed( - "zcat ${pauseImage} | docker load" + "${pauseImage} | docker load" ) machine.succeed("k3s kubectl apply -f ${testPodYaml}") diff --git a/nixos/tests/k3s.nix b/nixos/tests/k3s-single-node.nix index dfebca50677a..d98f20d468cb 100644 --- a/nixos/tests/k3s.nix +++ b/nixos/tests/k3s-single-node.nix @@ -1,11 +1,14 @@ import ./make-test-python.nix ({ pkgs, ... }: let - # A suitable k3s pause image, also used for the test pod - pauseImage = pkgs.dockerTools.buildImage { + imageEnv = pkgs.buildEnv { + name = "k3s-pause-image-env"; + paths = with pkgs; [ tini (hiPrio coreutils) busybox ]; + }; + pauseImage = pkgs.dockerTools.streamLayeredImage { name = "test.local/pause"; tag = "local"; - contents = with pkgs; [ tini coreutils busybox ]; + contents = imageEnv; config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ]; }; # Don't use the default service account because there's a race where it may @@ -39,8 +42,8 @@ import ./make-test-python.nix ({ pkgs, ... }: environment.systemPackages = with pkgs; [ k3s gzip ]; # k3s uses enough resources the default vm fails. - virtualisation.memorySize = pkgs.lib.mkDefault 1536; - virtualisation.diskSize = pkgs.lib.mkDefault 4096; + virtualisation.memorySize = 1536; + virtualisation.diskSize = 4096; services.k3s.enable = true; services.k3s.role = "server"; @@ -63,10 +66,11 @@ import ./make-test-python.nix ({ pkgs, ... }: machine.wait_for_unit("k3s") machine.succeed("k3s kubectl cluster-info") machine.fail("sudo -u noprivs k3s kubectl cluster-info") - # machine.succeed("k3s check-config") # fails with the current nixos kernel config, uncomment once this passes + # FIXME: this fails with the current nixos kernel config; once it passes, we should uncomment it + # machine.succeed("k3s check-config") machine.succeed( - "zcat ${pauseImage} | k3s ctr image import -" + "${pauseImage} | k3s ctr image import -" ) machine.succeed("k3s kubectl apply -f ${testPodYaml}") |