Merge pull request #309904 from superherointj/k3s-format-rfc

k3s: enforce rfc 0166 format
This commit is contained in:
superherointj 2024-05-10 20:25:35 -03:00 committed by GitHub
commit 602a9cec5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 525 additions and 331 deletions

View File

@ -111,3 +111,6 @@ fb0e5be84331188a69b3edd31679ca6576edb75a
# pkgs/os-specific/bsd: Reformat with nixfmt-rfc-style 2024-03-01 # pkgs/os-specific/bsd: Reformat with nixfmt-rfc-style 2024-03-01
3fe3b055adfc020e6a923c466b6bcd978a13069a 3fe3b055adfc020e6a923c466b6bcd978a13069a
# k3s: format with nixfmt-rfc-style
0b7900d5e8e0bcac89e14a52d3e840f9201e9f47

View File

@ -39,6 +39,10 @@ jobs:
pkgs/development/cuda-modules pkgs/development/cuda-modules
pkgs/test/cuda pkgs/test/cuda
pkgs/top-level/cuda-packages.nix pkgs/top-level/cuda-packages.nix
NIX_FMT_PATHS_K3S: |
nixos/modules/services/cluster/k3s
nixos/tests/k3s
pkgs/applications/networking/cluster/k3s
NIX_FMT_PATHS_VSCODE_EXTS: pkgs/applications/editors/vscode/extensions NIX_FMT_PATHS_VSCODE_EXTS: pkgs/applications/editors/vscode/extensions
NIX_FMT_PATHS_PHP_PACKAGES: pkgs/development/php-packages NIX_FMT_PATHS_PHP_PACKAGES: pkgs/development/php-packages
NIX_FMT_PATHS_BUILD_SUPPORT_PHP: pkgs/build-support/php NIX_FMT_PATHS_BUILD_SUPPORT_PHP: pkgs/build-support/php

View File

@ -1,15 +1,25 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
let let
cfg = config.services.k3s; cfg = config.services.k3s;
removeOption = config: instruction: removeOption =
lib.mkRemovedOptionModule ([ "services" "k3s" ] ++ config) instruction; config: instruction:
lib.mkRemovedOptionModule (
[
"services"
"k3s"
]
++ config
) instruction;
in in
{ {
imports = [ imports = [ (removeOption [ "docker" ] "k3s docker option is no longer supported.") ];
(removeOption [ "docker" ] "k3s docker option is no longer supported.")
];
# interface # interface
options.services.k3s = { options.services.k3s = {
@ -33,7 +43,10 @@ in
- `serverAddr` is required. - `serverAddr` is required.
''; '';
default = "server"; default = "server";
type = types.enum [ "server" "agent" ]; type = types.enum [
"server"
"agent"
];
}; };
serverAddr = mkOption { serverAddr = mkOption {
@ -125,7 +138,8 @@ in
message = "serverAddr or configPath (with 'server' key) should be set if role is 'agent'"; message = "serverAddr or configPath (with 'server' key) should be set if role is 'agent'";
} }
{ {
assertion = cfg.role == "agent" -> cfg.configPath != null || cfg.tokenFile != null || cfg.token != ""; assertion =
cfg.role == "agent" -> cfg.configPath != null || cfg.tokenFile != null || cfg.token != "";
message = "token or tokenFile or configPath (with 'token' or 'token-file' keys) should be set if role is 'agent'"; message = "token or tokenFile or configPath (with 'token' or 'token-file' keys) should be set if role is 'agent'";
} }
{ {
@ -142,8 +156,14 @@ in
systemd.services.k3s = { systemd.services.k3s = {
description = "k3s service"; description = "k3s service";
after = [ "firewall.service" "network-online.target" ]; after = [
wants = [ "firewall.service" "network-online.target" ]; "firewall.service"
"network-online.target"
];
wants = [
"firewall.service"
"network-online.target"
];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = optional config.boot.zfs.enabled config.boot.zfs.package; path = optional config.boot.zfs.enabled config.boot.zfs.package;
serviceConfig = { serviceConfig = {
@ -159,9 +179,7 @@ in
TasksMax = "infinity"; TasksMax = "infinity";
EnvironmentFile = cfg.environmentFile; EnvironmentFile = cfg.environmentFile;
ExecStart = concatStringsSep " \\\n " ( ExecStart = concatStringsSep " \\\n " (
[ [ "${cfg.package}/bin/k3s ${cfg.role}" ]
"${cfg.package}/bin/k3s ${cfg.role}"
]
++ (optional cfg.clusterInit "--cluster-init") ++ (optional cfg.clusterInit "--cluster-init")
++ (optional cfg.disableAgent "--disable-agent") ++ (optional cfg.disableAgent "--disable-agent")
++ (optional (cfg.serverAddr != "") "--server ${cfg.serverAddr}") ++ (optional (cfg.serverAddr != "") "--server ${cfg.serverAddr}")

View File

@ -1,16 +1,20 @@
{ system ? builtins.currentSystem {
, pkgs ? import ../../.. { inherit system; } system ? builtins.currentSystem,
, lib ? pkgs.lib pkgs ? import ../../.. { inherit system; },
lib ? pkgs.lib,
}: }:
let let
allK3s = lib.filterAttrs (n: _: lib.strings.hasPrefix "k3s_" n) pkgs; allK3s = lib.filterAttrs (n: _: lib.strings.hasPrefix "k3s_" n) pkgs;
in in
{ {
# Testing K3s with Etcd backend # Testing K3s with Etcd backend
etcd = lib.mapAttrs (_: k3s: import ./etcd.nix { etcd = lib.mapAttrs (
_: k3s:
import ./etcd.nix {
inherit system pkgs k3s; inherit system pkgs k3s;
inherit (pkgs) etcd; inherit (pkgs) etcd;
}) allK3s; }
) allK3s;
# 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 = lib.mapAttrs (_: k3s: import ./single-node.nix { inherit system pkgs k3s; }) allK3s; 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

View File

@ -1,15 +1,27 @@
import ../make-test-python.nix ({ pkgs, lib, k3s, etcd, ... }: import ../make-test-python.nix (
{
pkgs,
lib,
k3s,
etcd,
...
}:
{ {
name = "${k3s.name}-etcd"; name = "${k3s.name}-etcd";
nodes = { nodes = {
etcd = { ... }: { etcd =
{ ... }:
{
services.etcd = { services.etcd = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
listenClientUrls = [ "http://192.168.1.1:2379" "http://127.0.0.1:2379" ]; listenClientUrls = [
"http://192.168.1.1:2379"
"http://127.0.0.1:2379"
];
listenPeerUrls = [ "http://192.168.1.1:2380" ]; listenPeerUrls = [ "http://192.168.1.1:2380" ];
initialAdvertisePeerUrls = [ "http://192.168.1.1:2380" ]; initialAdvertisePeerUrls = [ "http://192.168.1.1:2380" ];
initialCluster = [ "etcd=http://192.168.1.1:2380" ]; initialCluster = [ "etcd=http://192.168.1.1:2380" ];
@ -18,12 +30,17 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, etcd, ... }:
useDHCP = false; useDHCP = false;
defaultGateway = "192.168.1.1"; defaultGateway = "192.168.1.1";
interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [ interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [
{ address = "192.168.1.1"; prefixLength = 24; } {
address = "192.168.1.1";
prefixLength = 24;
}
]; ];
}; };
}; };
k3s = { pkgs, ... }: { k3s =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [ jq ]; environment.systemPackages = with pkgs; [ jq ];
# k3s uses enough resources the default vm fails. # k3s uses enough resources the default vm fails.
virtualisation.memorySize = 1536; virtualisation.memorySize = 1536;
@ -34,28 +51,40 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, etcd, ... }:
role = "server"; role = "server";
extraFlags = builtins.toString [ extraFlags = builtins.toString [
"--datastore-endpoint=\"http://192.168.1.1:2379\"" "--datastore-endpoint=\"http://192.168.1.1:2379\""
"--disable" "coredns" "--disable"
"--disable" "local-storage" "coredns"
"--disable" "metrics-server" "--disable"
"--disable" "servicelb" "local-storage"
"--disable" "traefik" "--disable"
"--node-ip" "192.168.1.2" "metrics-server"
"--disable"
"servicelb"
"--disable"
"traefik"
"--node-ip"
"192.168.1.2"
]; ];
}; };
networking = { networking = {
firewall = { firewall = {
allowedTCPPorts = [ 2379 2380 6443 ]; allowedTCPPorts = [
2379
2380
6443
];
allowedUDPPorts = [ 8472 ]; allowedUDPPorts = [ 8472 ];
}; };
useDHCP = false; useDHCP = false;
defaultGateway = "192.168.1.2"; defaultGateway = "192.168.1.2";
interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [ interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [
{ address = "192.168.1.2"; prefixLength = 24; } {
address = "192.168.1.2";
prefixLength = 24;
}
]; ];
}; };
}; };
}; };
testScript = '' testScript = ''
@ -97,4 +126,5 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, etcd, ... }:
''; '';
meta.maintainers = etcd.meta.maintainers ++ k3s.meta.maintainers; meta.maintainers = etcd.meta.maintainers ++ k3s.meta.maintainers;
}) }
)

View File

@ -1,14 +1,30 @@
import ../make-test-python.nix ({ pkgs, lib, k3s, ... }: 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";
paths = with pkgs; [ tini bashInteractive coreutils socat ]; paths = with pkgs; [
tini
bashInteractive
coreutils
socat
];
}; };
pauseImage = pkgs.dockerTools.streamLayeredImage { pauseImage = pkgs.dockerTools.streamLayeredImage {
name = "test.local/pause"; name = "test.local/pause";
tag = "local"; tag = "local";
contents = imageEnv; contents = imageEnv;
config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ]; config.Entrypoint = [
"/bin/tini"
"--"
"/bin/sleep"
"inf"
];
}; };
# A daemonset that responds 'server' on port 8000 # A daemonset that responds 'server' on port 8000
networkTestDaemonset = pkgs.writeText "test.yml" '' networkTestDaemonset = pkgs.writeText "test.yml" ''
@ -42,8 +58,13 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
name = "${k3s.name}-multi-node"; name = "${k3s.name}-multi-node";
nodes = { nodes = {
server = { pkgs, ... }: { server =
environment.systemPackages = with pkgs; [ gzip jq ]; { pkgs, ... }:
{
environment.systemPackages = with pkgs; [
gzip
jq
];
# k3s uses enough resources the default vm fails. # k3s uses enough resources the default vm fails.
virtualisation.memorySize = 1536; virtualisation.memorySize = 1536;
virtualisation.diskSize = 4096; virtualisation.diskSize = 4096;
@ -55,27 +76,46 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
package = k3s; package = k3s;
clusterInit = true; clusterInit = true;
extraFlags = builtins.toString [ extraFlags = builtins.toString [
"--disable" "coredns" "--disable"
"--disable" "local-storage" "coredns"
"--disable" "metrics-server" "--disable"
"--disable" "servicelb" "local-storage"
"--disable" "traefik" "--disable"
"--node-ip" "192.168.1.1" "metrics-server"
"--pause-image" "test.local/pause:local" "--disable"
"servicelb"
"--disable"
"traefik"
"--node-ip"
"192.168.1.1"
"--pause-image"
"test.local/pause:local"
]; ];
}; };
networking.firewall.allowedTCPPorts = [ 2379 2380 6443 ]; networking.firewall.allowedTCPPorts = [
2379
2380
6443
];
networking.firewall.allowedUDPPorts = [ 8472 ]; networking.firewall.allowedUDPPorts = [ 8472 ];
networking.firewall.trustedInterfaces = [ "flannel.1" ]; networking.firewall.trustedInterfaces = [ "flannel.1" ];
networking.useDHCP = false; networking.useDHCP = false;
networking.defaultGateway = "192.168.1.1"; networking.defaultGateway = "192.168.1.1";
networking.interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [ networking.interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [
{ address = "192.168.1.1"; prefixLength = 24; } {
address = "192.168.1.1";
prefixLength = 24;
}
]; ];
}; };
server2 = { pkgs, ... }: { server2 =
environment.systemPackages = with pkgs; [ gzip jq ]; { pkgs, ... }:
{
environment.systemPackages = with pkgs; [
gzip
jq
];
virtualisation.memorySize = 1536; virtualisation.memorySize = 1536;
virtualisation.diskSize = 4096; virtualisation.diskSize = 4096;
@ -85,26 +125,42 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
serverAddr = "https://192.168.1.1:6443"; serverAddr = "https://192.168.1.1:6443";
clusterInit = false; clusterInit = false;
extraFlags = builtins.toString [ extraFlags = builtins.toString [
"--disable" "coredns" "--disable"
"--disable" "local-storage" "coredns"
"--disable" "metrics-server" "--disable"
"--disable" "servicelb" "local-storage"
"--disable" "traefik" "--disable"
"--node-ip" "192.168.1.3" "metrics-server"
"--pause-image" "test.local/pause:local" "--disable"
"servicelb"
"--disable"
"traefik"
"--node-ip"
"192.168.1.3"
"--pause-image"
"test.local/pause:local"
]; ];
}; };
networking.firewall.allowedTCPPorts = [ 2379 2380 6443 ]; networking.firewall.allowedTCPPorts = [
2379
2380
6443
];
networking.firewall.allowedUDPPorts = [ 8472 ]; networking.firewall.allowedUDPPorts = [ 8472 ];
networking.firewall.trustedInterfaces = [ "flannel.1" ]; networking.firewall.trustedInterfaces = [ "flannel.1" ];
networking.useDHCP = false; networking.useDHCP = false;
networking.defaultGateway = "192.168.1.3"; networking.defaultGateway = "192.168.1.3";
networking.interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [ networking.interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [
{ address = "192.168.1.3"; prefixLength = 24; } {
address = "192.168.1.3";
prefixLength = 24;
}
]; ];
}; };
agent = { pkgs, ... }: { agent =
{ pkgs, ... }:
{
virtualisation.memorySize = 1024; virtualisation.memorySize = 1024;
virtualisation.diskSize = 2048; virtualisation.diskSize = 2048;
services.k3s = { services.k3s = {
@ -113,8 +169,10 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
role = "agent"; role = "agent";
serverAddr = "https://192.168.1.3:6443"; serverAddr = "https://192.168.1.3:6443";
extraFlags = lib.concatStringsSep " " [ extraFlags = lib.concatStringsSep " " [
"--pause-image" "test.local/pause:local" "--pause-image"
"--node-ip" "192.168.1.2" "test.local/pause:local"
"--node-ip"
"192.168.1.2"
]; ];
}; };
networking.firewall.allowedTCPPorts = [ 6443 ]; networking.firewall.allowedTCPPorts = [ 6443 ];
@ -123,7 +181,10 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
networking.useDHCP = false; networking.useDHCP = false;
networking.defaultGateway = "192.168.1.2"; networking.defaultGateway = "192.168.1.2";
networking.interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [ networking.interfaces.eth1.ipv4.addresses = pkgs.lib.mkForce [
{ address = "192.168.1.2"; prefixLength = 24; } {
address = "192.168.1.2";
prefixLength = 24;
}
]; ];
}; };
}; };
@ -178,4 +239,5 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
for m in machines: for m in machines:
m.shutdown() m.shutdown()
''; '';
}) }
)

View File

@ -1,14 +1,29 @@
import ../make-test-python.nix ({ pkgs, lib, k3s, ... }: 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";
paths = with pkgs; [ tini (hiPrio coreutils) busybox ]; paths = with pkgs; [
tini
(hiPrio coreutils)
busybox
];
}; };
pauseImage = pkgs.dockerTools.streamLayeredImage { pauseImage = pkgs.dockerTools.streamLayeredImage {
name = "test.local/pause"; name = "test.local/pause";
tag = "local"; tag = "local";
contents = imageEnv; contents = imageEnv;
config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ]; config.Entrypoint = [
"/bin/tini"
"--"
"/bin/sleep"
"inf"
];
}; };
testPodYaml = pkgs.writeText "test.yml" '' testPodYaml = pkgs.writeText "test.yml" ''
apiVersion: v1 apiVersion: v1
@ -27,8 +42,13 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
name = "${k3s.name}-single-node"; name = "${k3s.name}-single-node";
meta.maintainers = k3s.meta.maintainers; meta.maintainers = k3s.meta.maintainers;
nodes.machine = { pkgs, ... }: { nodes.machine =
environment.systemPackages = with pkgs; [ k3s gzip ]; { pkgs, ... }:
{
environment.systemPackages = with pkgs; [
k3s
gzip
];
# k3s uses enough resources the default vm fails. # k3s uses enough resources the default vm fails.
virtualisation.memorySize = 1536; virtualisation.memorySize = 1536;
@ -39,12 +59,18 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
services.k3s.package = 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"
"--disable" "local-storage" "coredns"
"--disable" "metrics-server" "--disable"
"--disable" "servicelb" "local-storage"
"--disable" "traefik" "--disable"
"--pause-image" "test.local/pause:local" "metrics-server"
"--disable"
"servicelb"
"--disable"
"traefik"
"--pause-image"
"test.local/pause:local"
]; ];
users.users = { users.users = {
@ -56,14 +82,16 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
}; };
}; };
testScript = '' testScript =
''
start_all() start_all()
machine.wait_for_unit("k3s") machine.wait_for_unit("k3s")
machine.succeed("kubectl cluster-info") machine.succeed("kubectl cluster-info")
machine.fail("sudo -u noprivs kubectl cluster-info") machine.fail("sudo -u noprivs kubectl cluster-info")
'' # Fix-Me: Tests fail for 'aarch64-linux' as: "CONFIG_CGROUP_FREEZER: missing (fail)" '' # Fix-Me: Tests fail for 'aarch64-linux' as: "CONFIG_CGROUP_FREEZER: missing (fail)"
+ lib.optionalString (!pkgs.stdenv.isAarch64) ''machine.succeed("k3s check-config")'' + '' + lib.optionalString (!pkgs.stdenv.isAarch64) ''machine.succeed("k3s check-config")''
+ ''
machine.succeed( machine.succeed(
"${pauseImage} | ctr image import -" "${pauseImage} | ctr image import -"
@ -92,4 +120,5 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
machine.shutdown() machine.shutdown()
''; '';
}) }
)

View File

@ -29,41 +29,42 @@ lib:
# currently. # currently.
# It is likely we will have to split out additional builders for additional # It is likely we will have to split out additional builders for additional
# versions in the future, or customize this one further. # versions in the future, or customize this one further.
{ lib {
, makeWrapper lib,
, socat makeWrapper,
, iptables socat,
, iproute2 iptables,
, ipset iproute2,
, bridge-utils ipset,
, btrfs-progs bridge-utils,
, conntrack-tools btrfs-progs,
, buildGoModule conntrack-tools,
, runc buildGoModule,
, rsync runc,
, kmod rsync,
, libseccomp kmod,
, pkg-config libseccomp,
, ethtool pkg-config,
, util-linux ethtool,
, fetchFromGitHub util-linux,
, fetchurl fetchFromGitHub,
, fetchzip fetchurl,
, fetchgit fetchzip,
, zstd fetchgit,
, yq-go zstd,
, sqlite yq-go,
, nixosTests sqlite,
, pkgsBuildBuild nixosTests,
, go pkgsBuildBuild,
, runCommand go,
, bash runCommand,
, procps bash,
, coreutils procps,
, gnugrep coreutils,
, findutils gnugrep,
, gnused findutils,
, systemd gnused,
systemd,
}: }:
# k3s is a kinda weird derivation. One of the main points of k3s is the # k3s is a kinda weird derivation. One of the main points of k3s is the
@ -91,7 +92,13 @@ let
description = "A lightweight Kubernetes distribution"; description = "A lightweight Kubernetes distribution";
license = licenses.asl20; license = licenses.asl20;
homepage = "https://k3s.io"; homepage = "https://k3s.io";
maintainers = with maintainers; [ euank mic92 superherointj wrmilling yajo ]; maintainers = with maintainers; [
euank
mic92
superherointj
wrmilling
yajo
];
platforms = platforms.linux; platforms = platforms.linux;
# resolves collisions with other installations of kubectl, crictl, ctr # resolves collisions with other installations of kubectl, crictl, ctr
@ -231,12 +238,19 @@ let
vendorHash = k3sVendorHash; vendorHash = k3sVendorHash;
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ libseccomp sqlite.dev ]; buildInputs = [
libseccomp
sqlite.dev
];
subPackages = [ "cmd/server" ]; subPackages = [ "cmd/server" ];
ldflags = versionldflags; ldflags = versionldflags;
tags = [ "ctrd" "libsqlite3" "linux" ]; tags = [
"ctrd"
"libsqlite3"
"linux"
];
# create the multicall symlinks for k3s # create the multicall symlinks for k3s
postInstall = '' postInstall = ''
@ -282,7 +296,11 @@ buildGoModule rec {
pname = "k3s"; pname = "k3s";
version = k3sVersion; version = k3sVersion;
tags = [ "libsqlite3" "linux" "ctrd" ]; tags = [
"libsqlite3"
"linux"
"ctrd"
];
src = k3sRepo; src = k3sRepo;
vendorHash = k3sVendorHash; vendorHash = k3sVendorHash;
@ -400,15 +418,17 @@ buildGoModule rec {
passthru.updateScript = updateScript; passthru.updateScript = updateScript;
passthru.mkTests = version: passthru.mkTests =
let k3s_version = "k3s_" + lib.replaceStrings ["."] ["_"] (lib.versions.majorMinor version); version:
in { let
k3s_version = "k3s_" + lib.replaceStrings [ "." ] [ "_" ] (lib.versions.majorMinor version);
in
{
etcd = nixosTests.k3s.etcd.${k3s_version}; etcd = nixosTests.k3s.etcd.${k3s_version};
single-node = nixosTests.k3s.single-node.${k3s_version}; single-node = nixosTests.k3s.single-node.${k3s_version};
multi-node = nixosTests.k3s.multi-node.${k3s_version}; multi-node = nixosTests.k3s.multi-node.${k3s_version};
}; };
passthru.tests = passthru.mkTests k3sVersion; passthru.tests = passthru.mkTests k3sVersion;
meta = baseMeta; meta = baseMeta;
} }

View File

@ -12,22 +12,46 @@ let
extraArgs = builtins.removeAttrs args [ "callPackage" ]; extraArgs = builtins.removeAttrs args [ "callPackage" ];
in in
{ {
k3s_1_26 = common ((import ./1_26/versions.nix) // { k3s_1_26 = common (
updateScript = [ ./update-script.sh "26" ]; (import ./1_26/versions.nix)
}) extraArgs; // {
updateScript = [
./update-script.sh
"26"
];
}
) extraArgs;
# 1_27 can be built with the same builder as 1_26 # 1_27 can be built with the same builder as 1_26
k3s_1_27 = common ((import ./1_27/versions.nix) // { k3s_1_27 = common (
updateScript = [ ./update-script.sh "27" ]; (import ./1_27/versions.nix)
}) extraArgs; // {
updateScript = [
./update-script.sh
"27"
];
}
) extraArgs;
# 1_28 can be built with the same builder as 1_26 # 1_28 can be built with the same builder as 1_26
k3s_1_28 = common ((import ./1_28/versions.nix) // { k3s_1_28 = common (
updateScript = [ ./update-script.sh "28" ]; (import ./1_28/versions.nix)
}) extraArgs; // {
updateScript = [
./update-script.sh
"28"
];
}
) extraArgs;
# 1_29 can be built with the same builder as 1_26 # 1_29 can be built with the same builder as 1_26
k3s_1_29 = common ((import ./1_29/versions.nix) // { k3s_1_29 = common (
updateScript = [ ./update-script.sh "29" ]; (import ./1_29/versions.nix)
}) extraArgs; // {
updateScript = [
./update-script.sh
"29"
];
}
) extraArgs;
} }