nixos/tests/k3s: address pr feedback
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
import ./make-test-python.nix ({ pkgs, ... }:
|
import ./make-test-python.nix ({ pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# A suitable k3s pause image, also used for the test pod
|
imageEnv = pkgs.buildEnv {
|
||||||
pauseImage = pkgs.dockerTools.buildImage {
|
name = "k3s-pause-image-env";
|
||||||
|
paths = with pkgs; [ tini (hiPrio coreutils) busybox ];
|
||||||
|
};
|
||||||
|
pauseImage = pkgs.dockerTools.streamLayeredImage {
|
||||||
name = "test.local/pause";
|
name = "test.local/pause";
|
||||||
tag = "local";
|
tag = "local";
|
||||||
contents = with pkgs; [ tini coreutils busybox ];
|
contents = imageEnv;
|
||||||
config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ];
|
config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ];
|
||||||
};
|
};
|
||||||
# Don't use the default service account because there's a race where it may
|
# 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 ];
|
environment.systemPackages = with pkgs; [ k3s gzip ];
|
||||||
|
|
||||||
# k3s uses enough resources the default vm fails.
|
# k3s uses enough resources the default vm fails.
|
||||||
virtualisation.memorySize = pkgs.lib.mkDefault 1536;
|
virtualisation.memorySize = 1536;
|
||||||
virtualisation.diskSize = pkgs.lib.mkDefault 4096;
|
virtualisation.diskSize = 4096;
|
||||||
|
|
||||||
services.k3s = {
|
services.k3s = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -65,10 +68,11 @@ import ./make-test-python.nix ({ pkgs, ... }:
|
|||||||
machine.wait_for_unit("k3s")
|
machine.wait_for_unit("k3s")
|
||||||
machine.succeed("k3s kubectl cluster-info")
|
machine.succeed("k3s kubectl cluster-info")
|
||||||
machine.fail("sudo -u noprivs 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(
|
machine.succeed(
|
||||||
"zcat ${pauseImage} | docker load"
|
"${pauseImage} | docker load"
|
||||||
)
|
)
|
||||||
|
|
||||||
machine.succeed("k3s kubectl apply -f ${testPodYaml}")
|
machine.succeed("k3s kubectl apply -f ${testPodYaml}")
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
import ./make-test-python.nix ({ pkgs, ... }:
|
import ./make-test-python.nix ({ pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# A suitable k3s pause image, also used for the test pod
|
imageEnv = pkgs.buildEnv {
|
||||||
pauseImage = pkgs.dockerTools.buildImage {
|
name = "k3s-pause-image-env";
|
||||||
|
paths = with pkgs; [ tini (hiPrio coreutils) busybox ];
|
||||||
|
};
|
||||||
|
pauseImage = pkgs.dockerTools.streamLayeredImage {
|
||||||
name = "test.local/pause";
|
name = "test.local/pause";
|
||||||
tag = "local";
|
tag = "local";
|
||||||
contents = with pkgs; [ tini coreutils busybox ];
|
contents = imageEnv;
|
||||||
config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ];
|
config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ];
|
||||||
};
|
};
|
||||||
# Don't use the default service account because there's a race where it may
|
# 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 ];
|
environment.systemPackages = with pkgs; [ k3s gzip ];
|
||||||
|
|
||||||
# k3s uses enough resources the default vm fails.
|
# k3s uses enough resources the default vm fails.
|
||||||
virtualisation.memorySize = pkgs.lib.mkDefault 1536;
|
virtualisation.memorySize = 1536;
|
||||||
virtualisation.diskSize = pkgs.lib.mkDefault 4096;
|
virtualisation.diskSize = 4096;
|
||||||
|
|
||||||
services.k3s.enable = true;
|
services.k3s.enable = true;
|
||||||
services.k3s.role = "server";
|
services.k3s.role = "server";
|
||||||
@@ -63,10 +66,11 @@ import ./make-test-python.nix ({ pkgs, ... }:
|
|||||||
machine.wait_for_unit("k3s")
|
machine.wait_for_unit("k3s")
|
||||||
machine.succeed("k3s kubectl cluster-info")
|
machine.succeed("k3s kubectl cluster-info")
|
||||||
machine.fail("sudo -u noprivs 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(
|
machine.succeed(
|
||||||
"zcat ${pauseImage} | k3s ctr image import -"
|
"${pauseImage} | k3s ctr image import -"
|
||||||
)
|
)
|
||||||
|
|
||||||
machine.succeed("k3s kubectl apply -f ${testPodYaml}")
|
machine.succeed("k3s kubectl apply -f ${testPodYaml}")
|
||||||
Reference in New Issue
Block a user