Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: sync k3s and rke2 with major Kubernetes version #98

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions create_crio_sysext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SCRIPTFOLDER="$(dirname "$(readlink -f "$0")")"

if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Usage: $0 VERSION SYSEXTNAME"
echo "The script will download the cri-o release binaries (e.g., for 1.28.4) and create a sysext squashfs image with the name SYSEXTNAME.raw in the current folder."
echo "The script will download the cri-o release binaries (e.g., for v1.28.4) and create a sysext squashfs image with the name SYSEXTNAME.raw in the current folder."
echo "A temporary directory named SYSEXTNAME in the current folder will be created and deleted again."
echo "All files in the sysext image will be owned by root."
echo "To use arm64 pass 'ARCH=arm64' as environment variable (current value is '${ARCH}')."
Expand All @@ -18,6 +18,9 @@ fi
VERSION="$1"
SYSEXTNAME="$2"

# For compatibility with existing automation.
[[ "${VERSION}" == v* ]] || VERSION="v${VERSION}"

# The github release uses different arch identifiers (not the same as in the other scripts here),
# we map them here and rely on bake.sh to map them back to what systemd expects
if [ "${ARCH}" = "x86_64" ] || [ "${ARCH}" = "x86-64" ]; then
Expand All @@ -26,11 +29,11 @@ elif [ "${ARCH}" = "aarch64" ]; then
ARCH="arm64"
fi

rm -f "cri-o.${ARCH}.v${VERSION}.tar.gz"
curl -o "cri-o.${ARCH}.v${VERSION}.tar.gz" -fsSL "https://storage.googleapis.com/cri-o/artifacts/cri-o.${ARCH}.v${VERSION}.tar.gz"
rm -f "cri-o.${ARCH}.${VERSION}.tar.gz"
curl -o "cri-o.${ARCH}.${VERSION}.tar.gz" -fsSL "https://storage.googleapis.com/cri-o/artifacts/cri-o.${ARCH}.${VERSION}.tar.gz"
rm -rf "${SYSEXTNAME}"
mkdir -p "${SYSEXTNAME}" "${SYSEXTNAME}/tmp"
tar --force-local -xf "cri-o.${ARCH}.v${VERSION}.tar.gz" -C "${SYSEXTNAME}/tmp"
tar --force-local -xf "cri-o.${ARCH}.${VERSION}.tar.gz" -C "${SYSEXTNAME}/tmp"
cd "${SYSEXTNAME}/tmp/cri-o/"
sed -i '/^sed -i.*DESTDIR/d' install # removes sed replacements from install script to keep the default location (/usr) in the base config file
DESTDIR="${PWD}/../../../${SYSEXTNAME}" PREFIX=/usr ETCDIR=$PREFIX/share/crio/etc OCIDIR=$PREFIX/share/oci-umount/oci-umount.d \
Expand Down
62 changes: 39 additions & 23 deletions release_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,37 @@ fi
KBS_VERS_ARRAY=(${KBS_VERS})
printf "%s\n" "${KBS_VERS_ARRAY[@]}"

echo "Fetching list of latest CRI-O patch releases"
echo "================================================="

git ls-remote --tags --sort=-v:refname https://github.com/cri-o/cri-o \
| grep -v "{}" \
| awk '{ print $2}' \
| cut --delimiter='/' --fields=3 \
> crio.txt

CRIO=()
for r in "${KBS_VERS_ARRAY[@]}"; do
if ! grep -q "v${r%.*}" crio.txt; then
echo "Skipping $r"
continue
fi
version=$(cat crio.txt | grep "v${r%.*}" | head -n1)
CRIO+=( "crio-${version:1}" )
done
# fetch_releases returns available for a given software
# based on Kubernetes major versions.
function fetch_releases {
local software="${1}"
local file; file=$(mktemp)
krnowak marked this conversation as resolved.
Show resolved Hide resolved
local versions=()

git ls-remote --tags --sort=-v:refname "https://github.com/${software}" \
| grep -v "{}" \
| awk '{ print $2}' \
| cut --delimiter='/' --fields=3 \
> "${file}"

local version component r
for r in "${KBS_VERS_ARRAY[@]}"; do
krnowak marked this conversation as resolved.
Show resolved Hide resolved
if ! grep -q "v${r%.*}" "${file}"; then
echo "Skipping $r"
continue
fi
version=$(cat "${file}" | grep "v${r%.*}" | grep -v "rc"| head -n1)
component="${software#*/}"
krnowak marked this conversation as resolved.
Show resolved Hide resolved

# remove extra '-' from component name (e.g cri-o -> crio)
component="${component//-/}"
versions+=( "${component}-${version}" )
done

rm -f "${file}"

echo "${versions[@]}"
}

echo
echo "Fetching previous 'latest' release sysexts"
Expand Down Expand Up @@ -71,7 +84,9 @@ KUBERNETES=()
for v in "${KBS_VERS_ARRAY[@]}"; do
KUBERNETES+=( "kubernetes-v${v}" )
done
images+=( "${CRIO[@]}" )
images+=( $(fetch_releases "k3s-io/k3s") )
images+=( $(fetch_releases "cri-o/cri-o") )
images+=( $(fetch_releases "rancher/rke2") )
images+=( "${KUBERNETES[@]}" )

echo "building: ${images[@]}"
Expand All @@ -94,10 +109,11 @@ for image in "${images[@]}"; do
echo "* ${target}" >> Release.md
done
streams+=("${component}:-@v")
if [ "${component}" = "kubernetes" ] || [ "${component}" = "crio" ]; then
streams+=("${component}-${version%.*}:.@v")
# Should give, e.g., v1.28 for v1.28.2 (use ${version#*.*.} to get 2)
fi
case "${component}" in
kubernetes|crio|rke2|k3s)
# Should give, e.g., v1.28 for v1.28.2 (use ${version#*.*.} to get 2)
streams+=("${component}-${version%.*}:.@v")
esac
done

echo "" >> Release.md
Expand Down
8 changes: 0 additions & 8 deletions release_build_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ wasmcloud-1.2.1

tailscale-1.70.0

k3s-v1.29.9+k3s1
k3s-v1.30.5+k3s1
k3s-v1.31.1+k3s1

rke2-v1.29.9+rke2r1
rke2-v1.30.5+rke2r1
rke2-v1.31.1+rke2r1

nvidia_runtime-v1.16.2

ollama-0.3.9
Expand Down