Merge pull request #215482 from moduon/k3s-test-all-versions
k3s: test all versions
This commit is contained in:
commit
e836805076
|
@ -1,9 +1,13 @@
|
||||||
{ system ? builtins.currentSystem
|
{ system ? builtins.currentSystem
|
||||||
, pkgs ? import ../../.. { inherit system; }
|
, pkgs ? import ../../.. { inherit system; }
|
||||||
|
, lib ? pkgs.lib
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
allK3s = lib.filterAttrs (n: _: lib.strings.hasPrefix "k3s_" n) pkgs;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
# Run a single node k3s cluster and verify a pod can run
|
# Run a single node k3s cluster and verify a pod can run
|
||||||
single-node = import ./single-node.nix { inherit system pkgs; };
|
single-node = lib.mapAttrs (_: k3s: import ./single-node.nix { inherit system pkgs k3s; }) allK3s;
|
||||||
# Run a multi-node k3s cluster and verify pod networking works across nodes
|
# Run a multi-node k3s cluster and verify pod networking works across nodes
|
||||||
multi-node = import ./multi-node.nix { inherit system pkgs; };
|
multi-node = lib.mapAttrs (_: k3s: import ./multi-node.nix { inherit system pkgs k3s; }) allK3s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import ../make-test-python.nix ({ pkgs, lib, ... }:
|
import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
|
||||||
let
|
let
|
||||||
imageEnv = pkgs.buildEnv {
|
imageEnv = pkgs.buildEnv {
|
||||||
name = "k3s-pause-image-env";
|
name = "k3s-pause-image-env";
|
||||||
|
@ -39,7 +39,7 @@ import ../make-test-python.nix ({ pkgs, lib, ... }:
|
||||||
tokenFile = pkgs.writeText "token" "p@s$w0rd";
|
tokenFile = pkgs.writeText "token" "p@s$w0rd";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
name = "k3s-multi-node";
|
name = "${k3s.name}-multi-node";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
server = { pkgs, ... }: {
|
server = { pkgs, ... }: {
|
||||||
|
@ -52,7 +52,7 @@ import ../make-test-python.nix ({ pkgs, lib, ... }:
|
||||||
inherit tokenFile;
|
inherit tokenFile;
|
||||||
enable = true;
|
enable = true;
|
||||||
role = "server";
|
role = "server";
|
||||||
package = pkgs.k3s;
|
package = k3s;
|
||||||
clusterInit = true;
|
clusterInit = true;
|
||||||
extraFlags = builtins.toString [
|
extraFlags = builtins.toString [
|
||||||
"--disable" "coredns"
|
"--disable" "coredns"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import ../make-test-python.nix ({ pkgs, lib, ... }:
|
import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
|
||||||
let
|
let
|
||||||
imageEnv = pkgs.buildEnv {
|
imageEnv = pkgs.buildEnv {
|
||||||
name = "k3s-pause-image-env";
|
name = "k3s-pause-image-env";
|
||||||
|
@ -24,7 +24,7 @@ import ../make-test-python.nix ({ pkgs, lib, ... }:
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
name = "k3s";
|
name = "${k3s.name}-single-node";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
maintainers = [ euank ];
|
maintainers = [ euank ];
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,7 @@ import ../make-test-python.nix ({ pkgs, lib, ... }:
|
||||||
|
|
||||||
services.k3s.enable = true;
|
services.k3s.enable = true;
|
||||||
services.k3s.role = "server";
|
services.k3s.role = "server";
|
||||||
services.k3s.package = pkgs.k3s;
|
services.k3s.package = k3s;
|
||||||
# Slightly reduce resource usage
|
# Slightly reduce resource usage
|
||||||
services.k3s.extraFlags = builtins.toString [
|
services.k3s.extraFlags = builtins.toString [
|
||||||
"--disable" "coredns"
|
"--disable" "coredns"
|
||||||
|
|
|
@ -320,8 +320,7 @@ buildGoModule rec {
|
||||||
# Fix-Me: Needs to be adapted specifically for 1.23
|
# Fix-Me: Needs to be adapted specifically for 1.23
|
||||||
# passthru.updateScript = ./update.sh;
|
# passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
# Fix-Me: Needs to be adapted specifically for 1.23
|
passthru.tests = k3s.passthru.mkTests k3sVersion;
|
||||||
# passthru.tests = { inherit (nixosTests) k3s-single-node k3s-single-node-docker; };
|
|
||||||
|
|
||||||
meta = baseMeta;
|
meta = baseMeta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,8 +322,7 @@ buildGoModule rec {
|
||||||
# Fix-Me: Needs to be adapted specifically for 1.24
|
# Fix-Me: Needs to be adapted specifically for 1.24
|
||||||
# passthru.updateScript = ./update.sh;
|
# passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
# Fix-Me: Needs to be adapted specifically for 1.24
|
passthru.tests = k3s.passthru.mkTests k3sVersion;
|
||||||
# passthru.tests = nixosTests.k3s;
|
|
||||||
|
|
||||||
meta = baseMeta;
|
meta = baseMeta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,8 +322,7 @@ buildGoModule rec {
|
||||||
# Fix-Me: Needs to be adapted specifically for 1.25
|
# Fix-Me: Needs to be adapted specifically for 1.25
|
||||||
# passthru.updateScript = ./update.sh;
|
# passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
# Fix-Me: Needs to be adapted specifically for 1.25
|
passthru.tests = k3s.passthru.mkTests k3sVersion;
|
||||||
# passthru.tests = nixosTests.k3s;
|
|
||||||
|
|
||||||
meta = baseMeta;
|
meta = baseMeta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,14 @@ buildGoModule rec {
|
||||||
|
|
||||||
passthru.updateScript = ./update.sh;
|
passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
passthru.tests = nixosTests.k3s;
|
passthru.mkTests = version:
|
||||||
|
let k3s_version = "k3s_" + lib.replaceStrings ["."] ["_"] (lib.versions.majorMinor version);
|
||||||
|
in {
|
||||||
|
single-node = nixosTests.k3s.single-node.${k3s_version};
|
||||||
|
multi-node = nixosTests.k3s.multi-node.${k3s_version};
|
||||||
|
};
|
||||||
|
passthru.tests = passthru.mkTests k3sVersion;
|
||||||
|
|
||||||
|
|
||||||
meta = baseMeta;
|
meta = baseMeta;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue