From d2e4dcda58e81dd4ff66fc62d867720dd9b7e82f Mon Sep 17 00:00:00 2001 From: salatiel Date: Fri, 19 Apr 2024 16:22:21 -0300 Subject: [PATCH 1/8] add CRIO support --- create_crio_sysext.sh | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 create_crio_sysext.sh diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh new file mode 100755 index 0000000..ff6dfb8 --- /dev/null +++ b/create_crio_sysext.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +set -euo pipefail + +export ARCH="${ARCH-x86-64}" +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 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}')." + echo "CNI version current value is 'latest'" + "${SCRIPTFOLDER}"/bake.sh --help + exit 1 +fi + +VERSION="$1" +SYSEXTNAME="$2" + +# 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 + ARCH="amd64" +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 -rf "${SYSEXTNAME}" +mkdir -p "${SYSEXTNAME}" "${SYSEXTNAME}/tmp" +tar --force-local -xf cri-o.${ARCH}.v${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="${SCRIPTFOLDER}/${SYSEXTNAME}" PREFIX=/usr ETCDIR=$PREFIX/share/crio/etc OCIDIR=$PREFIX/share/oci-umount/oci-umount.d \ + CNIDIR=$PREFIX/share/crio/cni/etc/net.d/ OPT_CNI_BIN_DIR=$PREFIX/share/crio/cni/bin/ BASHINSTALLDIR=/tmp FISHINSTALLDIR=/tmp ZSHINSTALLDIR=/tmp MANDIR=/tmp ./install +cd "${SCRIPTFOLDER}" +rm -rf "${SYSEXTNAME}/tmp" + + +cat > "${SYSEXTNAME}"/usr/share/crio/etc/crio/crio.conf <<'EOF' +# /etc/crio/crio.conf - Configuration file for crio +# See /etc/crio/crio.conf.d/ for additional config files +# +EOF + +cat > "${SYSEXTNAME}"/usr/share/crio/README-flatcar <<'EOF' +To use kubernetes with crio in flatcar, you will need to pass the criSocket to kubeadm. +Eg: kubeadm init --pod-network-cidr=10.244.0.0/16 --kubernetes-version v1.29.2 --cri-socket=unix:///var/run/crio/crio.sock' +EOF + + +mkdir -p "${SYSEXTNAME}"/usr/lib/systemd/system/crio.service.d +cat > "${SYSEXTNAME}"/usr/lib/systemd/system/crio.service.d/10-crio.conf <<-'EOF' +[Service] +Environment="CONTAINER_CNI_PLUGIN_DIR=/opt/cni/bin" +Environment="CONTAINER_CONFIG=/etc/crio/crio.conf" +Environment="CONTAINER_CNI_CONFIG_DIR=/etc/cni/net.d" +ExecStartPre=/usr/bin/mkdir -p /opt/cni/bin /etc/crio/crio.conf.d/ /etc/cni/net.d/ /var/log/crio +ExecStartPre=/usr/bin/rsync -ur /usr/share/crio/etc/ /etc/ +ExecStart= +ExecStart=/usr/bin/crio --config-dir /etc/crio/crio.conf.d/ \ + $CRIO_CONFIG_OPTIONS \ + $CRIO_RUNTIME_OPTIONS \ + $CRIO_STORAGE_OPTIONS \ + $CRIO_NETWORK_OPTIONS \ + $CRIO_METRICS_OPTIONS +EOF + +mkdir -p "${SYSEXTNAME}"/usr/lib/systemd/system/multi-user.target.d +{ echo "[Unit]"; echo "Upholds=crio.service"; } > "${SYSEXTNAME}"/usr/lib/systemd/system/multi-user.target.d/10-crio.conf + +RELOAD=1 "${SCRIPTFOLDER}"/bake.sh "${SYSEXTNAME}" +rm -rf "${SYSEXTNAME}" From cbc04f0c9614c17179a60296e4fecd1fae46ce58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Mon, 22 Apr 2024 05:16:13 +0200 Subject: [PATCH 2/8] Update create_crio_sysext.sh --- create_crio_sysext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh index ff6dfb8..ae7a787 100755 --- a/create_crio_sysext.sh +++ b/create_crio_sysext.sh @@ -33,7 +33,7 @@ mkdir -p "${SYSEXTNAME}" "${SYSEXTNAME}/tmp" tar --force-local -xf cri-o.${ARCH}.v${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="${SCRIPTFOLDER}/${SYSEXTNAME}" PREFIX=/usr ETCDIR=$PREFIX/share/crio/etc OCIDIR=$PREFIX/share/oci-umount/oci-umount.d \ +DESTDIR="${PWD}/${SYSEXTNAME}" PREFIX=/usr ETCDIR=$PREFIX/share/crio/etc OCIDIR=$PREFIX/share/oci-umount/oci-umount.d \ CNIDIR=$PREFIX/share/crio/cni/etc/net.d/ OPT_CNI_BIN_DIR=$PREFIX/share/crio/cni/bin/ BASHINSTALLDIR=/tmp FISHINSTALLDIR=/tmp ZSHINSTALLDIR=/tmp MANDIR=/tmp ./install cd "${SCRIPTFOLDER}" rm -rf "${SYSEXTNAME}/tmp" From 651eaf60f4a6023dd7341f7ddbab284bd3f357b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Mon, 22 Apr 2024 05:17:22 +0200 Subject: [PATCH 3/8] Update create_crio_sysext.sh --- create_crio_sysext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh index ae7a787..39b6d64 100755 --- a/create_crio_sysext.sh +++ b/create_crio_sysext.sh @@ -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 v1.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 1.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}')." From ca46977135ea1b4f280b0043268416c5c96851be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Mon, 22 Apr 2024 05:27:27 +0200 Subject: [PATCH 4/8] Update create_crio_sysext.sh --- create_crio_sysext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh index 39b6d64..3edcf1a 100755 --- a/create_crio_sysext.sh +++ b/create_crio_sysext.sh @@ -33,7 +33,7 @@ mkdir -p "${SYSEXTNAME}" "${SYSEXTNAME}/tmp" tar --force-local -xf cri-o.${ARCH}.v${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 \ +DESTDIR="${PWD}/../../${SYSEXTNAME}" PREFIX=/usr ETCDIR=$PREFIX/share/crio/etc OCIDIR=$PREFIX/share/oci-umount/oci-umount.d \ CNIDIR=$PREFIX/share/crio/cni/etc/net.d/ OPT_CNI_BIN_DIR=$PREFIX/share/crio/cni/bin/ BASHINSTALLDIR=/tmp FISHINSTALLDIR=/tmp ZSHINSTALLDIR=/tmp MANDIR=/tmp ./install cd "${SCRIPTFOLDER}" rm -rf "${SYSEXTNAME}/tmp" From fb7fad9db2a56d394961fa7f0bc466022b0da0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Mon, 22 Apr 2024 05:29:05 +0200 Subject: [PATCH 5/8] Update create_crio_sysext.sh --- create_crio_sysext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh index 3edcf1a..47d8aa9 100755 --- a/create_crio_sysext.sh +++ b/create_crio_sysext.sh @@ -33,7 +33,7 @@ mkdir -p "${SYSEXTNAME}" "${SYSEXTNAME}/tmp" tar --force-local -xf cri-o.${ARCH}.v${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 \ +DESTDIR="${PWD}/../../../${SYSEXTNAME}" PREFIX=/usr ETCDIR=$PREFIX/share/crio/etc OCIDIR=$PREFIX/share/oci-umount/oci-umount.d \ CNIDIR=$PREFIX/share/crio/cni/etc/net.d/ OPT_CNI_BIN_DIR=$PREFIX/share/crio/cni/bin/ BASHINSTALLDIR=/tmp FISHINSTALLDIR=/tmp ZSHINSTALLDIR=/tmp MANDIR=/tmp ./install cd "${SCRIPTFOLDER}" rm -rf "${SYSEXTNAME}/tmp" From 32dac6b16739fd43941a3027815a031c526949f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Mon, 22 Apr 2024 05:29:12 +0200 Subject: [PATCH 6/8] Update create_crio_sysext.sh --- create_crio_sysext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh index 47d8aa9..4485cf7 100755 --- a/create_crio_sysext.sh +++ b/create_crio_sysext.sh @@ -35,7 +35,7 @@ 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 \ CNIDIR=$PREFIX/share/crio/cni/etc/net.d/ OPT_CNI_BIN_DIR=$PREFIX/share/crio/cni/bin/ BASHINSTALLDIR=/tmp FISHINSTALLDIR=/tmp ZSHINSTALLDIR=/tmp MANDIR=/tmp ./install -cd "${SCRIPTFOLDER}" +cd - rm -rf "${SYSEXTNAME}/tmp" From a97bb33e1c8457b3e5c87c05abd43938bae3ef9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Mon, 22 Apr 2024 05:32:24 +0200 Subject: [PATCH 7/8] Update create_crio_sysext.sh --- create_crio_sysext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh index 4485cf7..a8a3578 100755 --- a/create_crio_sysext.sh +++ b/create_crio_sysext.sh @@ -30,7 +30,7 @@ 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 -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}.v${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 \ From 01e8634632a7fd6f1a8ba890a8594a1a169ab43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Mon, 22 Apr 2024 05:32:46 +0200 Subject: [PATCH 8/8] Update create_crio_sysext.sh --- create_crio_sysext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_crio_sysext.sh b/create_crio_sysext.sh index a8a3578..b7b1944 100755 --- a/create_crio_sysext.sh +++ b/create_crio_sysext.sh @@ -31,7 +31,7 @@ curl -o "cri-o.${ARCH}.v${VERSION}.tar.gz" -fsSL "https://storage.googleapis.com rm -rf "${SYSEXTNAME}" mkdir -p "${SYSEXTNAME}" "${SYSEXTNAME}/tmp" tar --force-local -xf "cri-o.${ARCH}.v${VERSION}.tar.gz" -C "${SYSEXTNAME}/tmp" -cd ${SYSEXTNAME}/tmp/cri-o/ +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 \ CNIDIR=$PREFIX/share/crio/cni/etc/net.d/ OPT_CNI_BIN_DIR=$PREFIX/share/crio/cni/bin/ BASHINSTALLDIR=/tmp FISHINSTALLDIR=/tmp ZSHINSTALLDIR=/tmp MANDIR=/tmp ./install