From 49b299074d4fbd2becdc6dbc5362a3d0fc2fb2b1 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:50:56 -0300 Subject: [PATCH 1/3] k3s: convenience change to update script --- pkgs/applications/networking/cluster/k3s/update.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/cluster/k3s/update.sh b/pkgs/applications/networking/cluster/k3s/update.sh index 6c9755334cde..ac46e7ae51e5 100755 --- a/pkgs/applications/networking/cluster/k3s/update.sh +++ b/pkgs/applications/networking/cluster/k3s/update.sh @@ -7,8 +7,8 @@ WORKDIR=$(mktemp -d) trap "rm -rf ${WORKDIR}" EXIT NIXPKGS_ROOT="$(git rev-parse --show-toplevel)"/ -NIXPKGS_K3S_FOLDER=$(cd $(dirname ${BASH_SOURCE[0]}); pwd -P)/ -cd ${NIXPKGS_K3S_FOLDER} +NIXPKGS_K3S_PATH=$(cd $(dirname ${BASH_SOURCE[0]}); pwd -P)/ +cd ${NIXPKGS_K3S_PATH} LATEST_TAG_RAWFILE=${WORKDIR}/latest_tag.json curl --silent ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \ @@ -60,7 +60,7 @@ CRI_CTL_VERSION=$(grep github.com/kubernetes-sigs/cri-tools ${FILE_GO_MOD} \ | head -n1 | awk '{print $4}' | sed -e 's/"//g' -e 's/^v//') setKV () { - sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ${NIXPKGS_K3S_FOLDER}default.nix + sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ${NIXPKGS_K3S_PATH}default.nix } setKV k3sVersion ${K3S_VERSION} @@ -91,3 +91,11 @@ else echo "Update failed. K3S_VENDOR_SHA256 is empty." exit 1 fi + +# `git` flag here is to be used by local maintainers to speed up the bump process +if [ $# -eq 1 ] && [ "$1" = "git" ]; then + OLD_VERSION="$(nix-instantiate --eval -E "with import $NIXPKGS_ROOT. {}; k3s.version or (builtins.parseDrvName k3s.name).version" | tr -d '"')" + git switch -c "package-k3s-${K3S_VERSION}" + git add "$NIXPKGS_K3S_PATH"/default.nix + git commit -m "k3s: ${OLD_VERSION} -> ${K3S_VERSION}" +fi From 3d200bd959e9b448e52212e9989e109c6dce3ab4 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Thu, 29 Sep 2022 09:58:45 -0300 Subject: [PATCH 2/3] nixos/tests/k3s: fix tests * add superherointj as maintainer --- nixos/tests/k3s/multi-node.nix | 27 ++++++++++++++++++++++----- nixos/tests/k3s/single-node.nix | 17 +++++++++++++---- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/nixos/tests/k3s/multi-node.nix b/nixos/tests/k3s/multi-node.nix index ae9609fbccc9..e33fa3e36d27 100644 --- a/nixos/tests/k3s/multi-node.nix +++ b/nixos/tests/k3s/multi-node.nix @@ -1,4 +1,4 @@ -import ../make-test-python.nix ({ pkgs, ... }: +import ../make-test-python.nix ({ pkgs, lib, ... }: let imageEnv = pkgs.buildEnv { name = "k3s-pause-image-env"; @@ -54,7 +54,15 @@ import ../make-test-python.nix ({ pkgs, ... }: role = "server"; package = pkgs.k3s; clusterInit = true; - extraFlags = "--no-deploy coredns,servicelb,traefik,local-storage,metrics-server --pause-image test.local/pause:local --node-ip 192.168.1.1"; + extraFlags = '' + --disable coredns \ + --disable local-storage \ + --disable metrics-server \ + --disable servicelb \ + --disable traefik \ + --node-ip 192.168.1.1 \ + --pause-image test.local/pause:local + ''; }; networking.firewall.allowedTCPPorts = [ 2379 2380 6443 ]; networking.firewall.allowedUDPPorts = [ 8472 ]; @@ -76,7 +84,15 @@ import ../make-test-python.nix ({ pkgs, ... }: enable = true; serverAddr = "https://192.168.1.1:6443"; clusterInit = false; - extraFlags = "--no-deploy coredns,servicelb,traefik,local-storage,metrics-server --pause-image test.local/pause:local --node-ip 192.168.1.3"; + extraFlags = '' + --disable coredns \ + --disable local-storage \ + --disable metrics-server \ + --disable servicelb \ + --disable traefik \ + --node-ip 192.168.1.3 \ + --pause-image test.local/pause:local + ''; }; networking.firewall.allowedTCPPorts = [ 2379 2380 6443 ]; networking.firewall.allowedUDPPorts = [ 8472 ]; @@ -110,7 +126,7 @@ import ../make-test-python.nix ({ pkgs, ... }: }; meta = with pkgs.lib.maintainers; { - maintainers = [ euank ]; + maintainers = [ euank superherointj ]; }; testScript = '' @@ -123,7 +139,8 @@ import ../make-test-python.nix ({ pkgs, ... }: server.wait_until_succeeds("k3s kubectl get node agent") for m in machines: - m.succeed("k3s check-config") + '' # Fix-Me: Tests fail for 'aarch64-linux' as: "CONFIG_CGROUP_FREEZER: missing (fail)" + + lib.optionalString (!pkgs.stdenv.isAarch64) ''m.succeed("k3s check-config")'' + '' m.succeed( "${pauseImage} | k3s ctr image import -" ) diff --git a/nixos/tests/k3s/single-node.nix b/nixos/tests/k3s/single-node.nix index 27e1e455e641..583aac8ac656 100644 --- a/nixos/tests/k3s/single-node.nix +++ b/nixos/tests/k3s/single-node.nix @@ -1,4 +1,4 @@ -import ../make-test-python.nix ({ pkgs, ... }: +import ../make-test-python.nix ({ pkgs, lib, ... }: let imageEnv = pkgs.buildEnv { name = "k3s-pause-image-env"; @@ -26,7 +26,7 @@ import ../make-test-python.nix ({ pkgs, ... }: { name = "k3s"; meta = with pkgs.lib.maintainers; { - maintainers = [ euank ]; + maintainers = [ euank superherointj ]; }; nodes.machine = { pkgs, ... }: { @@ -40,7 +40,15 @@ import ../make-test-python.nix ({ pkgs, ... }: services.k3s.role = "server"; services.k3s.package = pkgs.k3s; # Slightly reduce resource usage - services.k3s.extraFlags = "--no-deploy coredns,servicelb,traefik,local-storage,metrics-server --pause-image test.local/pause:local"; + services.k3s.extraFlags = '' + --disable coredns \ + --disable local-storage \ + --disable metrics-server \ + --disable servicelb \ + --disable traefik \ + --pause-image \ + test.local/pause:local + ''; users.users = { noprivs = { @@ -57,7 +65,8 @@ 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") + '' # Fix-Me: Tests fail for 'aarch64-linux' as: "CONFIG_CGROUP_FREEZER: missing (fail)" + + lib.optionalString (!pkgs.stdenv.isAarch64) ''machine.succeed("k3s check-config")'' + '' machine.succeed( "${pauseImage} | k3s ctr image import -" From 2d55e4d1eed9c39fcadea9ebbbd46ea4f866f3f7 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:56:09 -0300 Subject: [PATCH 3/3] k3s: 1.25.2+k3s1 -> 1.25.2+k3s1 --- pkgs/applications/networking/cluster/k3s/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/cluster/k3s/default.nix b/pkgs/applications/networking/cluster/k3s/default.nix index 47caa1721336..1fed375117c2 100644 --- a/pkgs/applications/networking/cluster/k3s/default.nix +++ b/pkgs/applications/networking/cluster/k3s/default.nix @@ -47,10 +47,10 @@ with lib; # Those pieces of software we entirely ignore upstream's handling of, and just # make sure they're in the path if desired. let - k3sVersion = "1.25.0+k3s1"; # k3s git tag - k3sCommit = "26e9405767263a2915723cb72b1ffd7f50687a8f"; # k3s git commit at the above version - k3sRepoSha256 = "0rk0svqx26rn6qlvvyj5rsqb87195h1qcf84qmmvf874qwszwpgh"; - k3sVendorSha256 = "sha256-YX/yLOLtDxGhRB4tic6oTli/qeeSnpP+f+S+sVXXDSs="; + k3sVersion = "1.25.2+k3s1"; # k3s git tag + k3sCommit = "53c268d8eb90ceea5e1c7865f89db5c7fb8763bc"; # k3s git commit at the above version + k3sRepoSha256 = "1w040bsrf981k19rwaaxjsv52pgzc0k77x083fkhysmrca565z0y"; + k3sVendorSha256 = "sha256-8Xti08sjFk1WKimH/GEb99oqBdFO79WVCvYyXIWMpgo="; # taken from ./manifests/traefik.yaml, extracted from '.spec.chart' https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/download#L9 # The 'patch' and 'minor' versions are currently hardcoded as single digits only, so ignore the trailing two digits. Weird, I know.