k3s: 1.19.4+k3s2 -> 1.20.4+k3s1

Notably, this includes support for unified cgroups in k3s, which is
especially convenient given nixos has moved to them.

Fixes (at least partly) #111835
This commit is contained in:
Euan Kemp 2021-02-24 00:28:13 -08:00
parent a346c68411
commit f922b3016c
2 changed files with 16 additions and 32 deletions

View file

@ -19,6 +19,7 @@
, fetchurl
, fetchzip
, fetchgit
, zstd
}:
with lib;
@ -43,9 +44,9 @@ 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.19.4+k3s2"; # k3s git tag
k3sVersion = "1.20.4+k3s1"; # k3s git tag
traefikChartVersion = "1.81.0"; # taken from ./scripts/download at the above k3s tag
k3sRootVersion = "0.7.1"; # taken from ./scripts/download at the above k3s tag
k3sRootVersion = "0.8.1"; # taken from ./scripts/download at the above k3s tag
k3sCNIVersion = "0.8.6-k3s1"; # taken from ./scripts/version.sh at the above k3s tag
# bundled into the k3s binary
traefikChart = fetchurl {
@ -64,7 +65,7 @@ let
k3sRoot = fetchzip {
# Note: marked as apache 2.0 license
url = "https://github.com/k3s-io/k3s-root/releases/download/v${k3sRootVersion}/k3s-root-amd64.tar";
sha256 = "1wjg54816plbdwgv0dibq6dzmcakcmx0wiqijvr4f3gsxgk59zwf";
sha256 = "sha256-r3Nkzl9ccry7cgD3YWlHvEWOsWnnFGIkyRH9sx12gks=";
stripRoot = false;
};
k3sPlugins = buildGoPackage rec {
@ -95,7 +96,7 @@ let
url = "https://github.com/k3s-io/k3s";
rev = "v${k3sVersion}";
leaveDotGit = true; # ./scripts/version.sh depends on git
sha256 = "1qxjdgnq8mf54760f0vngcqa2y3b048pcmfsf1g593b2ij1kg1zi";
sha256 = "0rmn3nh8a94axv6lb2xjnn3gpq0scnvj69bvcs74azvw62fvq016";
};
# Stage 1 of the k3s build:
# Let's talk about how k3s is structured.
@ -126,7 +127,12 @@ let
src = k3sRepo;
patches = [ ./patches/0001-Use-rm-from-path-in-go-generate.patch ./patches/0002-Add-nixpkgs-patches.patch ];
# Patch build scripts so that we can use them.
# This makes things more dynamically linked (because nix can deal with
# dynamically linked dependencies just fine), removes the upload at the
# end, and skips building runc + cni, since we have our own derivations for
# those.
patches = [ ./patches/0002-Add-nixpkgs-patches.patch ];
nativeBuildInputs = [ git pkg-config ];
buildInputs = [ libseccomp ];
@ -166,9 +172,10 @@ let
src = k3sRepo;
patches = [ ./patches/0001-Use-rm-from-path-in-go-generate.patch ./patches/0002-Add-nixpkgs-patches.patch ];
# See the above comment in k3sBuildStage1
patches = [ ./patches/0002-Add-nixpkgs-patches.patch ];
nativeBuildInputs = [ git pkg-config ];
nativeBuildInputs = [ git pkg-config zstd ];
# These dependencies are embedded as compressed files in k3s at runtime.
# Propagate them to avoid broken runtime references to libraries.
propagatedBuildInputs = [ k3sPlugins k3sBuildStage1 runc ];
@ -255,10 +262,12 @@ stdenv.mkDerivation rec {
# Use a wrapper script to reference all the binaries that k3s tries to
# execute, but that we didn't bundle with it.
installPhase = ''
runHook preInstall
mkdir -p "$out/bin"
makeWrapper ${k3sBin}/bin/k3s "$out/bin/k3s" \
--prefix PATH : ${lib.makeBinPath k3sRuntimeDeps} \
--prefix PATH : "$out/bin"
runHook postInstall
'';
meta = {

View file

@ -1,25 +0,0 @@
From e79ddef65d08599ae3fe8ff39d202ea2416650b8 Mon Sep 17 00:00:00 2001
From: Euan Kemp <euank@euank.com>
Date: Sun, 31 May 2020 17:27:05 -0700
Subject: [PATCH 1/2] Use 'rm' from path in go generate
/bin/rm is less portable. On some distros, like nixos, it doesn't exist
at all.
---
main.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.go b/main.go
index 62908bb7bb..0527222887 100644
--- a/main.go
+++ b/main.go
@@ -1,5 +1,5 @@
//go:generate go run pkg/codegen/cleanup/main.go
-//go:generate /bin/rm -rf pkg/generated
+//go:generate rm -rf pkg/generated
//go:generate go run pkg/codegen/main.go
//go:generate go fmt pkg/deploy/zz_generated_bindata.go
//go:generate go fmt pkg/static/zz_generated_bindata.go
--
2.25.4