k3s: add "1_26" builder which can be used for 1_27 too
This is meant to make it easier to maintain multiple versions of the package without having to copy+paste folders every time. We can still copy+paste if the builders diverge enough to warrant it.
This commit is contained in:
parent
68c1807f3c
commit
457f56813d
|
@ -1,5 +1,4 @@
|
||||||
{ stdenv
|
{ lib
|
||||||
, lib
|
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, socat
|
, socat
|
||||||
, iptables
|
, iptables
|
||||||
|
@ -27,6 +26,30 @@
|
||||||
, pkgsBuildBuild
|
, pkgsBuildBuild
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# git tag
|
||||||
|
k3sVersion,
|
||||||
|
# commit hash
|
||||||
|
k3sCommit,
|
||||||
|
k3sRepoSha256 ? lib.fakeHash,
|
||||||
|
k3sVendorSha256 ? lib.fakeHash,
|
||||||
|
# taken from ./scripts/version.sh VERSION_ROOT https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L47
|
||||||
|
k3sRootVersion,
|
||||||
|
k3sRootSha256 ? lib.fakeHash,
|
||||||
|
# Based on the traefik charts here: https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/scripts/download#L29-L32
|
||||||
|
# see also https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/manifests/traefik.yaml#L8
|
||||||
|
chartVersions,
|
||||||
|
# taken from ./scripts/version.sh VERSION_CNIPLUGINS https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L45
|
||||||
|
k3sCNIVersion,
|
||||||
|
k3sCNISha256 ? lib.fakeHash,
|
||||||
|
# taken from ./scripts/version.sh VERSION_CONTAINERD
|
||||||
|
containerdVersion,
|
||||||
|
containerdSha256 ? lib.fakeHash,
|
||||||
|
# run `grep github.com/kubernetes-sigs/cri-tools go.mod | head -n1 | awk '{print $4}'` in the k3s repo at the tag
|
||||||
|
criCtlVersion,
|
||||||
|
updateScript ? null,
|
||||||
|
}:
|
||||||
|
|
||||||
# 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
|
||||||
# simplicity of it being one binary that can perform several tasks.
|
# simplicity of it being one binary that can perform several tasks.
|
||||||
# However, when you have a good package manager (like nix), that doesn't
|
# However, when you have a good package manager (like nix), that doesn't
|
||||||
|
@ -47,31 +70,6 @@
|
||||||
# Those pieces of software we entirely ignore upstream's handling of, and just
|
# Those pieces of software we entirely ignore upstream's handling of, and just
|
||||||
# make sure they're in the path if desired.
|
# make sure they're in the path if desired.
|
||||||
let
|
let
|
||||||
k3sVersion = "1.26.4+k3s1"; # k3s git tag
|
|
||||||
k3sCommit = "8d0255af07e95b841952563253d27b0d10bd72f0"; # k3s git commit at the above version
|
|
||||||
k3sRepoSha256 = "0qlszdnlsvj3hzx2p0wl3zhaw908w8a62z6vlf2g69a3c75f55cs";
|
|
||||||
k3sVendorSha256 = "sha256-JXTsZYtTspu/pWMRSS2BcegktawBJ6BK7YEKbz1J/ao=";
|
|
||||||
|
|
||||||
# nix generated by update.sh
|
|
||||||
# Based on the traefik charts here: https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/scripts/download#L29-L32
|
|
||||||
# see also https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/manifests/traefik.yaml#L8
|
|
||||||
# At the time of writing, there are two traefik charts, and that's it
|
|
||||||
charts = import ./chart-versions.nix;
|
|
||||||
|
|
||||||
# taken from ./scripts/version.sh VERSION_ROOT https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L47
|
|
||||||
k3sRootVersion = "0.12.1";
|
|
||||||
k3sRootSha256 = "0724yx3zk89m2239fmdgwzf9w672pik71xqrvgb7pdmknmmdn9f4";
|
|
||||||
|
|
||||||
# taken from ./scripts/version.sh VERSION_CNIPLUGINS https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L45
|
|
||||||
k3sCNIVersion = "1.1.1-k3s1";
|
|
||||||
k3sCNISha256 = "14mb3zsqibj1sn338gjmsyksbm0mxv9p016dij7zidccx2rzn6nl";
|
|
||||||
|
|
||||||
# taken from ./scripts/version.sh VERSION_CONTAINERD
|
|
||||||
containerdVersion = "1.6.19-k3s1";
|
|
||||||
containerdSha256 = "12dwqh77wplg30kdi73d90qni23agw2cwxjd2p5lchq86mpmmwwr";
|
|
||||||
|
|
||||||
# run `grep github.com/kubernetes-sigs/cri-tools go.mod | head -n1 | awk '{print $4}'` in the k3s repo at the tag
|
|
||||||
criCtlVersion = "1.26.0-rc.0-k3s1";
|
|
||||||
|
|
||||||
baseMeta = with lib; {
|
baseMeta = with lib; {
|
||||||
description = "A lightweight Kubernetes distribution";
|
description = "A lightweight Kubernetes distribution";
|
||||||
|
@ -99,8 +97,8 @@ let
|
||||||
];
|
];
|
||||||
|
|
||||||
# bundled into the k3s binary
|
# bundled into the k3s binary
|
||||||
traefikChart = fetchurl charts.traefik;
|
traefikChart = fetchurl chartVersions.traefik;
|
||||||
traefik-crdChart = fetchurl charts.traefik-crd;
|
traefik-crdChart = fetchurl chartVersions.traefik-crd;
|
||||||
|
|
||||||
# so, k3s is a complicated thing to package
|
# so, k3s is a complicated thing to package
|
||||||
# This derivation attempts to avoid including any random binaries from the
|
# This derivation attempts to avoid including any random binaries from the
|
||||||
|
@ -168,7 +166,7 @@ let
|
||||||
# derivation when we've built all the binaries, but haven't bundled them in
|
# derivation when we've built all the binaries, but haven't bundled them in
|
||||||
# with generated bindata yet.
|
# with generated bindata yet.
|
||||||
|
|
||||||
k3sServer = buildGoModule rec {
|
k3sServer = buildGoModule {
|
||||||
pname = "k3s-server";
|
pname = "k3s-server";
|
||||||
version = k3sVersion;
|
version = k3sVersion;
|
||||||
|
|
||||||
|
@ -322,7 +320,7 @@ buildGoModule rec {
|
||||||
$out/bin/k3s --version | grep -F "v${k3sVersion}" >/dev/null
|
$out/bin/k3s --version | grep -F "v${k3sVersion}" >/dev/null
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.updateScript = ./update.sh;
|
passthru.updateScript = updateScript;
|
||||||
|
|
||||||
passthru.mkTests = version:
|
passthru.mkTests = version:
|
||||||
let k3s_version = "k3s_" + lib.replaceStrings ["."] ["_"] (lib.versions.majorMinor version);
|
let k3s_version = "k3s_" + lib.replaceStrings ["."] ["_"] (lib.versions.majorMinor version);
|
23
pkgs/applications/networking/cluster/k3s/default.nix
Normal file
23
pkgs/applications/networking/cluster/k3s/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ lib, stdenv, callPackage }:
|
||||||
|
|
||||||
|
let
|
||||||
|
# The 1_26 builder can compile 1.26, and hopefully newer versions
|
||||||
|
k3s_1_26_builder = import ./builders/1_26.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
k3s_1_26 = (callPackage k3s_1_26_builder { }) {
|
||||||
|
k3sVersion = "1.26.4+k3s1";
|
||||||
|
k3sCommit = "8d0255af07e95b841952563253d27b0d10bd72f0";
|
||||||
|
k3sRepoSha256 = "0qlszdnlsvj3hzx2p0wl3zhaw908w8a62z6vlf2g69a3c75f55cs";
|
||||||
|
k3sVendorSha256 = "sha256-JXTsZYtTspu/pWMRSS2BcegktawBJ6BK7YEKbz1J/ao=";
|
||||||
|
chartVersions = import ./1_26/chart-versions.nix;
|
||||||
|
k3sRootVersion = "0.12.1";
|
||||||
|
k3sRootSha256 = "0724yx3zk89m2239fmdgwzf9w672pik71xqrvgb7pdmknmmdn9f4";
|
||||||
|
k3sCNIVersion = "1.1.1-k3s1";
|
||||||
|
k3sCNISha256 = "14mb3zsqibj1sn338gjmsyksbm0mxv9p016dij7zidccx2rzn6nl";
|
||||||
|
containerdVersion = "1.6.19-k3s1";
|
||||||
|
containerdSha256 = "12dwqh77wplg30kdi73d90qni23agw2cwxjd2p5lchq86mpmmwwr";
|
||||||
|
criCtlVersion = "1.26.0-rc.0-k3s1";
|
||||||
|
updateScript = ./1_26/update-script.sh;
|
||||||
|
};
|
||||||
|
}
|
|
@ -31674,7 +31674,7 @@ with pkgs;
|
||||||
|
|
||||||
k3s_1_24 = callPackage ../applications/networking/cluster/k3s/1_24 { };
|
k3s_1_24 = callPackage ../applications/networking/cluster/k3s/1_24 { };
|
||||||
k3s_1_25 = callPackage ../applications/networking/cluster/k3s/1_25 { };
|
k3s_1_25 = callPackage ../applications/networking/cluster/k3s/1_25 { };
|
||||||
k3s_1_26 = callPackage ../applications/networking/cluster/k3s/1_26 { };
|
k3s_1_26 = (callPackage ../applications/networking/cluster/k3s { }).k3s_1_26;
|
||||||
k3s = k3s_1_26;
|
k3s = k3s_1_26;
|
||||||
|
|
||||||
k3sup = callPackage ../applications/networking/cluster/k3sup { };
|
k3sup = callPackage ../applications/networking/cluster/k3sup { };
|
||||||
|
|
Loading…
Reference in a new issue