Merge pull request #239030 from euank/euan/k3s-1-26-bump
This commit is contained in:
commit
a0930d1a13
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
traefik-crd = {
|
traefik-crd = {
|
||||||
url = "https://k3s.io/k3s-charts/assets/traefik-crd/traefik-crd-20.3.1+up20.3.0.tgz";
|
url = "https://k3s.io/k3s-charts/assets/traefik-crd/traefik-crd-21.2.1+up21.2.0.tgz";
|
||||||
sha256 = "1775vjldvqvhzdbzanxhbaqbmkih09yb91im651q8bc7z5sb9ckn";
|
sha256 = "05j3vyikb7g2z2i07rij9h4ki5lb2hb2rynpiqfd4l1y5qm0qhw9";
|
||||||
};
|
};
|
||||||
traefik = {
|
traefik = {
|
||||||
url = "https://k3s.io/k3s-charts/assets/traefik/traefik-20.3.1+up20.3.0.tgz";
|
url = "https://k3s.io/k3s-charts/assets/traefik/traefik-21.2.1+up21.2.0.tgz";
|
||||||
sha256 = "1rj0f0n0vgjcbzfwzhqmsd501i2f6vw145w9plbp8gwdyzmg2nc6";
|
sha256 = "0gvz0yzph2893scd0q10b938yc7f36b3zqs57pkjgqqpl1d0nwhg";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,123 +0,0 @@
|
||||||
#!/usr/bin/env nix-shell
|
|
||||||
#!nix-shell -i bash -p curl gnugrep gnused jq yq-go nix-prefetch
|
|
||||||
|
|
||||||
set -x -eu -o pipefail
|
|
||||||
|
|
||||||
WORKDIR=$(mktemp -d)
|
|
||||||
trap "rm -rf ${WORKDIR}" EXIT
|
|
||||||
|
|
||||||
NIXPKGS_ROOT="$(git rev-parse --show-toplevel)"/
|
|
||||||
NIXPKGS_K3S_PATH=$(cd $(dirname ${BASH_SOURCE[0]}); pwd -P)/
|
|
||||||
cd ${NIXPKGS_K3S_PATH}
|
|
||||||
|
|
||||||
LATEST_TAG_RAWFILE=${WORKDIR}/latest_tag.json
|
|
||||||
curl --silent -f ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
|
|
||||||
https://api.github.com/repos/k3s-io/k3s/releases > ${LATEST_TAG_RAWFILE}
|
|
||||||
|
|
||||||
LATEST_TAG_NAME=$(jq 'map(.tag_name)' ${LATEST_TAG_RAWFILE} | \
|
|
||||||
grep -v -e rc -e engine | tail -n +2 | head -n -1 | sed 's|[", ]||g' | sort -rV | head -n1)
|
|
||||||
|
|
||||||
K3S_VERSION=$(echo ${LATEST_TAG_NAME} | sed 's/^v//')
|
|
||||||
|
|
||||||
K3S_COMMIT=$(curl --silent -f ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
|
|
||||||
https://api.github.com/repos/k3s-io/k3s/tags \
|
|
||||||
| jq -r "map(select(.name == \"${LATEST_TAG_NAME}\")) | .[0] | .commit.sha")
|
|
||||||
|
|
||||||
K3S_REPO_SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/k3s-io/k3s/archive/refs/tags/${LATEST_TAG_NAME}.tar.gz)
|
|
||||||
|
|
||||||
FILE_SCRIPTS_DOWNLOAD=${WORKDIR}/scripts-download
|
|
||||||
curl --silent -f https://raw.githubusercontent.com/k3s-io/k3s/${K3S_COMMIT}/scripts/download > $FILE_SCRIPTS_DOWNLOAD
|
|
||||||
|
|
||||||
FILE_SCRIPTS_VERSION=${WORKDIR}/scripts-version.sh
|
|
||||||
curl --silent -f https://raw.githubusercontent.com/k3s-io/k3s/${K3S_COMMIT}/scripts/version.sh > $FILE_SCRIPTS_VERSION
|
|
||||||
|
|
||||||
FILE_TRAEFIK_MANIFEST=${WORKDIR}/traefik.yml
|
|
||||||
curl --silent -f -o "$FILE_TRAEFIK_MANIFEST" https://raw.githubusercontent.com/k3s-io/k3s/${K3S_COMMIT}/manifests/traefik.yaml
|
|
||||||
|
|
||||||
CHART_FILES=( $(yq eval --no-doc .spec.chart "$FILE_TRAEFIK_MANIFEST" | xargs -n1 basename) )
|
|
||||||
# These files are:
|
|
||||||
# 1. traefik-crd-20.3.1+up20.3.0.tgz
|
|
||||||
# 2. traefik-20.3.1+up20.3.0.tgz
|
|
||||||
# at the time of writing
|
|
||||||
|
|
||||||
if [[ "${#CHART_FILES[@]}" != "2" ]]; then
|
|
||||||
echo "New manifest charts added, the packaging scripts will need to be updated: ${CHART_FILES}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
CHARTS_URL=https://k3s.io/k3s-charts/assets
|
|
||||||
# Get metadata for both files
|
|
||||||
rm -f chart-versions.nix.update
|
|
||||||
cat > chart-versions.nix.update <<EOF
|
|
||||||
{
|
|
||||||
traefik-crd = {
|
|
||||||
url = "${CHARTS_URL}/traefik-crd/${CHART_FILES[0]}";
|
|
||||||
sha256 = "$(nix-prefetch-url --quiet "${CHARTS_URL}/traefik-crd/${CHART_FILES[0]}")";
|
|
||||||
};
|
|
||||||
traefik = {
|
|
||||||
url = "${CHARTS_URL}/traefik/${CHART_FILES[1]}";
|
|
||||||
sha256 = "$(nix-prefetch-url --quiet "${CHARTS_URL}/traefik/${CHART_FILES[1]}")";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
mv chart-versions.nix.update chart-versions.nix
|
|
||||||
|
|
||||||
FILE_GO_MOD=${WORKDIR}/go.mod
|
|
||||||
curl --silent https://raw.githubusercontent.com/k3s-io/k3s/${K3S_COMMIT}/go.mod > $FILE_GO_MOD
|
|
||||||
|
|
||||||
|
|
||||||
K3S_ROOT_VERSION=$(grep 'VERSION_ROOT=' ${FILE_SCRIPTS_VERSION} \
|
|
||||||
| cut -d'=' -f2 | sed -e 's/"//g' -e 's/^v//')
|
|
||||||
K3S_ROOT_SHA256=$(nix-prefetch-url --quiet --unpack \
|
|
||||||
"https://github.com/k3s-io/k3s-root/releases/download/v${K3S_ROOT_VERSION}/k3s-root-amd64.tar")
|
|
||||||
|
|
||||||
CNIPLUGINS_VERSION=$(grep 'VERSION_CNIPLUGINS=' ${FILE_SCRIPTS_VERSION} \
|
|
||||||
| cut -d'=' -f2 | sed -e 's/"//g' -e 's/^v//')
|
|
||||||
CNIPLUGINS_SHA256=$(nix-prefetch-url --quiet --unpack \
|
|
||||||
"https://github.com/rancher/plugins/archive/refs/tags/v${CNIPLUGINS_VERSION}.tar.gz")
|
|
||||||
|
|
||||||
CONTAINERD_VERSION=$(grep 'VERSION_CONTAINERD=' ${FILE_SCRIPTS_VERSION} \
|
|
||||||
| cut -d'=' -f2 | sed -e 's/"//g' -e 's/^v//')
|
|
||||||
CONTAINERD_SHA256=$(nix-prefetch-url --quiet --unpack \
|
|
||||||
"https://github.com/k3s-io/containerd/archive/refs/tags/v${CONTAINERD_VERSION}.tar.gz")
|
|
||||||
|
|
||||||
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_PATH}default.nix
|
|
||||||
}
|
|
||||||
|
|
||||||
setKV k3sVersion ${K3S_VERSION}
|
|
||||||
setKV k3sCommit ${K3S_COMMIT}
|
|
||||||
setKV k3sRepoSha256 ${K3S_REPO_SHA256}
|
|
||||||
|
|
||||||
setKV k3sRootVersion ${K3S_ROOT_VERSION}
|
|
||||||
setKV k3sRootSha256 ${K3S_ROOT_SHA256}
|
|
||||||
|
|
||||||
setKV k3sCNIVersion ${CNIPLUGINS_VERSION}
|
|
||||||
setKV k3sCNISha256 ${CNIPLUGINS_SHA256}
|
|
||||||
|
|
||||||
setKV containerdVersion ${CONTAINERD_VERSION}
|
|
||||||
setKV containerdSha256 ${CONTAINERD_SHA256}
|
|
||||||
|
|
||||||
setKV criCtlVersion ${CRI_CTL_VERSION}
|
|
||||||
|
|
||||||
set +e
|
|
||||||
K3S_VENDOR_SHA256=$(nix-prefetch -I nixpkgs=${NIXPKGS_ROOT} "{ sha256 }: (import ${NIXPKGS_ROOT}. {}).k3s.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })")
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -n "${K3S_VENDOR_SHA256:-}" ]; then
|
|
||||||
setKV k3sVendorSha256 ${K3S_VENDOR_SHA256}
|
|
||||||
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
|
|
14
pkgs/applications/networking/cluster/k3s/1_26/versions.nix
Normal file
14
pkgs/applications/networking/cluster/k3s/1_26/versions.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
k3sVersion = "1.26.5+k3s1";
|
||||||
|
k3sCommit = "7cefebeaac7dbdd0bfec131ea7a43a45cb125354";
|
||||||
|
k3sRepoSha256 = "0iz8w24lhb3mgwnks79ky4nypdqbjn91zm4nrj1ar3abkb5i8bg3";
|
||||||
|
k3sVendorSha256 = "sha256-yPzpt9OZfW7qY9gFgrRVgmk2l9OSMMF85OY79MDCKTs=";
|
||||||
|
chartVersions = import ./chart-versions.nix;
|
||||||
|
k3sRootVersion = "0.12.2";
|
||||||
|
k3sRootSha256 = "1gjynvr350qni5mskgm7pcc7alss4gms4jmkiv453vs8mmma9c9k";
|
||||||
|
k3sCNIVersion = "1.2.0-k3s1";
|
||||||
|
k3sCNISha256 = "0hzcap4vbl94zsiqc66dlwjgql50gw5g6f0adag0p8yqwcy6vaw2";
|
||||||
|
containerdVersion = "1.7.1-k3s1";
|
||||||
|
containerdSha256 = "00k7nkclfxwbzcgnn8s7rkrxyn0zpk57nyy18icf23wsj352gfrn";
|
||||||
|
criCtlVersion = "1.26.0-rc.0-k3s1";
|
||||||
|
}
|
|
@ -21,13 +21,6 @@ lib:
|
||||||
# run `grep github.com/kubernetes-sigs/cri-tools go.mod | head -n1 | awk '{print $4}'` in the k3s repo at the tag
|
# run `grep github.com/kubernetes-sigs/cri-tools go.mod | head -n1 | awk '{print $4}'` in the k3s repo at the tag
|
||||||
criCtlVersion,
|
criCtlVersion,
|
||||||
updateScript ? null,
|
updateScript ? null,
|
||||||
# multicallContainerd is a temporary variable for migrating k3s versions
|
|
||||||
# forward, and can be removed once all callers set it.
|
|
||||||
# It is here so we can update 1.26 and 1.27 independently, but they'll both migrate to this.
|
|
||||||
# This variable controls whether we build with containerd as a separate
|
|
||||||
# binary, or as a k3s multicall. Upstream k3s changed this in 1.27.2 and
|
|
||||||
# 1.26.5. See https://github.com/k3s-io/k3s/issues/7419 for more context
|
|
||||||
multicallContainerd ? false,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
# builder.nix contains a "builder" expression that, given k3s version and hash
|
# builder.nix contains a "builder" expression that, given k3s version and hash
|
||||||
|
@ -193,13 +186,14 @@ let
|
||||||
subPackages = [ "cmd/server" ];
|
subPackages = [ "cmd/server" ];
|
||||||
ldflags = versionldflags;
|
ldflags = versionldflags;
|
||||||
|
|
||||||
tags = [ "libsqlite3" "linux" ] ++ lib.optional multicallContainerd "ctrd";
|
tags = [ "ctrd" "libsqlite3" "linux" ];
|
||||||
|
|
||||||
# create the multicall symlinks for k3s
|
# create the multicall symlinks for k3s
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mv $out/bin/server $out/bin/k3s
|
mv $out/bin/server $out/bin/k3s
|
||||||
pushd $out
|
pushd $out
|
||||||
# taken verbatim from https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/build#L105-L113
|
# taken verbatim from https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/build#L105-L113
|
||||||
|
ln -s k3s ./bin/containerd
|
||||||
ln -s k3s ./bin/crictl
|
ln -s k3s ./bin/crictl
|
||||||
ln -s k3s ./bin/ctr
|
ln -s k3s ./bin/ctr
|
||||||
ln -s k3s ./bin/k3s-agent
|
ln -s k3s ./bin/k3s-agent
|
||||||
|
@ -210,11 +204,6 @@ let
|
||||||
ln -s k3s ./bin/k3s-server
|
ln -s k3s ./bin/k3s-server
|
||||||
ln -s k3s ./bin/k3s-token
|
ln -s k3s ./bin/k3s-token
|
||||||
ln -s k3s ./bin/kubectl
|
ln -s k3s ./bin/kubectl
|
||||||
'' + lib.optionalString multicallContainerd ''
|
|
||||||
# for the multicall binary, also do containerd per
|
|
||||||
# https://github.com/k3s-io/k3s/blob/v1.27.2%2Bk3s1/scripts/build#L136-L146
|
|
||||||
ln -s k3s ./bin/containerd
|
|
||||||
'' + ''
|
|
||||||
popd
|
popd
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -222,7 +211,7 @@ let
|
||||||
description = "The various binaries that get packaged into the final k3s binary";
|
description = "The various binaries that get packaged into the final k3s binary";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# For the multicall binary, only used for the shim
|
# Only used for the shim since
|
||||||
# https://github.com/k3s-io/k3s/blob/v1.27.2%2Bk3s1/scripts/build#L153
|
# https://github.com/k3s-io/k3s/blob/v1.27.2%2Bk3s1/scripts/build#L153
|
||||||
k3sContainerd = buildGoModule {
|
k3sContainerd = buildGoModule {
|
||||||
pname = "k3s-containerd";
|
pname = "k3s-containerd";
|
||||||
|
@ -235,7 +224,7 @@ let
|
||||||
};
|
};
|
||||||
vendorSha256 = null;
|
vendorSha256 = null;
|
||||||
buildInputs = [ btrfs-progs ];
|
buildInputs = [ btrfs-progs ];
|
||||||
subPackages = [ "cmd/containerd-shim-runc-v2" ] ++ lib.optional (!multicallContainerd) "cmd/containerd";
|
subPackages = [ "cmd/containerd-shim-runc-v2" ];
|
||||||
ldflags = versionldflags;
|
ldflags = versionldflags;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -243,7 +232,7 @@ buildGoModule rec {
|
||||||
pname = "k3s";
|
pname = "k3s";
|
||||||
version = k3sVersion;
|
version = k3sVersion;
|
||||||
|
|
||||||
tags = [ "libsqlite3" "linux" ] ++ lib.optional multicallContainerd "ctrd";
|
tags = [ "libsqlite3" "linux" "ctrd" ];
|
||||||
src = k3sRepo;
|
src = k3sRepo;
|
||||||
vendorSha256 = k3sVendorSha256;
|
vendorSha256 = k3sVendorSha256;
|
||||||
|
|
||||||
|
@ -312,7 +301,6 @@ buildGoModule rec {
|
||||||
rsync -a --no-perms ${k3sServer}/bin/ ./bin/
|
rsync -a --no-perms ${k3sServer}/bin/ ./bin/
|
||||||
ln -vsf ${k3sCNIPlugins}/bin/cni ./bin/cni
|
ln -vsf ${k3sCNIPlugins}/bin/cni ./bin/cni
|
||||||
ln -vsf ${k3sContainerd}/bin/containerd-shim-runc-v2 ./bin
|
ln -vsf ${k3sContainerd}/bin/containerd-shim-runc-v2 ./bin
|
||||||
${lib.optionalString (!multicallContainerd) "ln -vsf ${k3sContainerd}/bin/containerd ./bin/"}
|
|
||||||
rsync -a --no-perms --chmod u=rwX ${k3sRoot}/etc/ ./etc/
|
rsync -a --no-perms --chmod u=rwX ${k3sRoot}/etc/ ./etc/
|
||||||
mkdir -p ./build/static/charts
|
mkdir -p ./build/static/charts
|
||||||
|
|
||||||
|
|
|
@ -5,24 +5,12 @@ let
|
||||||
common = opts: callPackage (k3s_builder opts);
|
common = opts: callPackage (k3s_builder opts);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
k3s_1_26 = common {
|
k3s_1_26 = common ((import ./1_26/versions.nix) // {
|
||||||
k3sVersion = "1.26.4+k3s1";
|
updateScript = [ ./update-script.sh "26" ];
|
||||||
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";
|
|
||||||
} { };
|
|
||||||
|
|
||||||
# 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 ((import ./1_27/versions.nix) // {
|
||||||
multicallContainerd = true;
|
|
||||||
updateScript = [ ./update-script.sh "27" ];
|
updateScript = [ ./update-script.sh "27" ];
|
||||||
}) { };
|
}) { };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue