From c3ae7fb77e437a28c7796eb67ded633d653e66a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mudrini=C4=87?= Date: Tue, 31 Jan 2023 17:15:30 +0100 Subject: [PATCH] [release/v0.3] Update containerd, docker, kubernetes-cni, and cri-tools (#261) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update containerd, docker, kubernetes-cni, and cri-tools Signed-off-by: Marko Mudrinić * Fix lib.sh Signed-off-by: Marko Mudrinić --------- Signed-off-by: Marko Mudrinić --- deploy/osps/default/osp-amzn2.yaml | 17 ++++---- deploy/osps/default/osp-centos.yaml | 19 +++++---- deploy/osps/default/osp-flatcar.yaml | 11 ++--- deploy/osps/default/osp-rhel.yaml | 19 +++++---- deploy/osps/default/osp-sles.yaml | 11 ++--- deploy/osps/default/osp-ubuntu.yaml | 19 +++++---- hack/lib.sh | 64 ++++++++++++++++++++-------- 7 files changed, 98 insertions(+), 62 deletions(-) diff --git a/deploy/osps/default/osp-amzn2.yaml b/deploy/osps/default/osp-amzn2.yaml index 36857507..cb649839 100644 --- a/deploy/osps/default/osp-amzn2.yaml +++ b/deploy/osps/default/osp-amzn2.yaml @@ -20,7 +20,7 @@ metadata: spec: osName: "amzn2" osVersion: "2.0" - version: "v0.1.0" + version: "v0.1.1" supportedCloudProviders: - name: "aws" supportedContainerRuntimes: @@ -64,7 +64,7 @@ spec: EOF yum install -y \ - containerd-1.4* \ + containerd-1.6* \ yum-plugin-versionlock yum versionlock add containerd @@ -91,8 +91,8 @@ spec: EOF yum install -y \ - containerd-1.4* \ - docker-19.03* \ + containerd-1.6* \ + docker-20.10* \ yum-plugin-versionlock yum versionlock add docker containerd @@ -128,7 +128,7 @@ spec: fi {{- /* # CNI variables */}} - CNI_VERSION="${CNI_VERSION:-v0.8.7}" + CNI_VERSION="${CNI_VERSION:-v1.2.0}" cni_base_url="https://github.com/containernetworking/plugins/releases/download/$CNI_VERSION" cni_filename="cni-plugins-linux-$arch-$CNI_VERSION.tgz" @@ -148,7 +148,7 @@ spec: cd - {{- /* # cri-tools variables */}} - CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.22.0}" + CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.26.0}" cri_tools_base_url="https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_TOOLS_RELEASE}" cri_tools_filename="crictl-${CRI_TOOLS_RELEASE}-linux-${arch}.tar.gz" @@ -156,8 +156,9 @@ spec: curl -Lfo "$opt_bin/$cri_tools_filename" "$cri_tools_base_url/$cri_tools_filename" {{- /* download cri-tools checksum */}} - {{- /* the cri-tools checksum file has a filename prefix that breaks sha256sum so we need to drop it with sed */}} - cri_tools_sum=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256" | sed 's/\*\///') + {{- /* the cri-tools checksum file provides only the checksum without the file name, so we need to handle it specially */}} + cri_tools_sum_value=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256") + cri_tools_sum="$cri_tools_sum_value $cri_tools_filename" cd "$opt_bin" {{- /* verify cri-tools checksum */}} diff --git a/deploy/osps/default/osp-centos.yaml b/deploy/osps/default/osp-centos.yaml index 679a05d0..042b7857 100644 --- a/deploy/osps/default/osp-centos.yaml +++ b/deploy/osps/default/osp-centos.yaml @@ -20,7 +20,7 @@ metadata: spec: osName: "centos" osVersion: "7.7" - version: "v0.1.0" + version: "v0.1.1" supportedCloudProviders: - name: "aws" - name: "azure" @@ -77,7 +77,7 @@ spec: EnvironmentFile=-/etc/environment EOF - yum install -y containerd.io-1.4* yum-plugin-versionlock + yum install -y containerd.io-1.6* yum-plugin-versionlock yum versionlock add containerd.io systemctl daemon-reload @@ -107,9 +107,9 @@ spec: EOF yum install -y \ - docker-ce-cli-19.03* \ - containerd.io-1.4* \ - docker-ce-19.03* \ + docker-ce-cli-20.10* \ + containerd.io-1.6* \ + docker-ce-20.10* \ yum-plugin-versionlock yum versionlock add docker-ce* containerd.io @@ -145,7 +145,7 @@ spec: fi {{- /* # CNI variables */}} - CNI_VERSION="${CNI_VERSION:-v0.8.7}" + CNI_VERSION="${CNI_VERSION:-v1.2.0}" cni_base_url="https://github.com/containernetworking/plugins/releases/download/$CNI_VERSION" cni_filename="cni-plugins-linux-$arch-$CNI_VERSION.tgz" @@ -165,7 +165,7 @@ spec: cd - {{- /* # cri-tools variables */}} - CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.22.0}" + CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.26.0}" cri_tools_base_url="https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_TOOLS_RELEASE}" cri_tools_filename="crictl-${CRI_TOOLS_RELEASE}-linux-${arch}.tar.gz" @@ -173,8 +173,9 @@ spec: curl -Lfo "$opt_bin/$cri_tools_filename" "$cri_tools_base_url/$cri_tools_filename" {{- /* download cri-tools checksum */}} - {{- /* the cri-tools checksum file has a filename prefix that breaks sha256sum so we need to drop it with sed */}} - cri_tools_sum=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256" | sed 's/\*\///') + {{- /* the cri-tools checksum file provides only the checksum without the file name, so we need to handle it specially */}} + cri_tools_sum_value=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256") + cri_tools_sum="$cri_tools_sum_value $cri_tools_filename" cd "$opt_bin" {{- /* verify cri-tools checksum */}} diff --git a/deploy/osps/default/osp-flatcar.yaml b/deploy/osps/default/osp-flatcar.yaml index 059ee319..192157c5 100644 --- a/deploy/osps/default/osp-flatcar.yaml +++ b/deploy/osps/default/osp-flatcar.yaml @@ -21,7 +21,7 @@ spec: osName: flatcar ## Flatcar Stable (09/11/2021) osVersion: "2983.2.0" - version: "v0.1.0" + version: "v0.1.1" supportedCloudProviders: - name: aws - name: azure @@ -115,7 +115,7 @@ spec: fi {{- /* # CNI variables */}} - CNI_VERSION="${CNI_VERSION:-v0.8.7}" + CNI_VERSION="${CNI_VERSION:-v1.2.0}" cni_base_url="https://github.com/containernetworking/plugins/releases/download/$CNI_VERSION" cni_filename="cni-plugins-linux-$arch-$CNI_VERSION.tgz" @@ -135,7 +135,7 @@ spec: cd - {{- /* # cri-tools variables */}} - CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.22.0}" + CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.26.0}" cri_tools_base_url="https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_TOOLS_RELEASE}" cri_tools_filename="crictl-${CRI_TOOLS_RELEASE}-linux-${arch}.tar.gz" @@ -143,8 +143,9 @@ spec: curl -Lfo "$opt_bin/$cri_tools_filename" "$cri_tools_base_url/$cri_tools_filename" {{- /* download cri-tools checksum */}} - {{- /* the cri-tools checksum file has a filename prefix that breaks sha256sum so we need to drop it with sed */}} - cri_tools_sum=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256" | sed 's/\*\///') + {{- /* the cri-tools checksum file provides only the checksum without the file name, so we need to handle it specially */}} + cri_tools_sum_value=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256") + cri_tools_sum="$cri_tools_sum_value $cri_tools_filename" cd "$opt_bin" {{- /* verify cri-tools checksum */}} diff --git a/deploy/osps/default/osp-rhel.yaml b/deploy/osps/default/osp-rhel.yaml index dd714984..7b3bc266 100644 --- a/deploy/osps/default/osp-rhel.yaml +++ b/deploy/osps/default/osp-rhel.yaml @@ -20,7 +20,7 @@ metadata: spec: osName: "rhel" osVersion: "8.4" - version: "v0.1.0" + version: "v0.1.1" supportedCloudProviders: - name: "aws" - name: "azure" @@ -74,7 +74,7 @@ spec: EnvironmentFile=-/etc/environment EOF - yum install -y containerd.io-1.4* yum-plugin-versionlock + yum install -y containerd.io-1.6* yum-plugin-versionlock yum versionlock add containerd.io systemctl daemon-reload @@ -104,9 +104,9 @@ spec: EOF yum install -y \ - docker-ce-cli-19.03* \ - containerd.io-1.4* \ - docker-ce-19.03* \ + docker-ce-cli-20.10* \ + containerd.io-1.6* \ + docker-ce-20.10* \ yum-plugin-versionlock yum versionlock add docker-ce* containerd.io @@ -142,7 +142,7 @@ spec: fi {{- /* # CNI variables */}} - CNI_VERSION="${CNI_VERSION:-v0.8.7}" + CNI_VERSION="${CNI_VERSION:-v1.2.0}" cni_base_url="https://github.com/containernetworking/plugins/releases/download/$CNI_VERSION" cni_filename="cni-plugins-linux-$arch-$CNI_VERSION.tgz" @@ -162,7 +162,7 @@ spec: cd - {{- /* # cri-tools variables */}} - CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.22.0}" + CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.26.0}" cri_tools_base_url="https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_TOOLS_RELEASE}" cri_tools_filename="crictl-${CRI_TOOLS_RELEASE}-linux-${arch}.tar.gz" @@ -170,8 +170,9 @@ spec: curl -Lfo "$opt_bin/$cri_tools_filename" "$cri_tools_base_url/$cri_tools_filename" {{- /* download cri-tools checksum */}} - {{- /* the cri-tools checksum file has a filename prefix that breaks sha256sum so we need to drop it with sed */}} - cri_tools_sum=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256" | sed 's/\*\///') + {{- /* the cri-tools checksum file provides only the checksum without the file name, so we need to handle it specially */}} + cri_tools_sum_value=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256") + cri_tools_sum="$cri_tools_sum_value $cri_tools_filename" cd "$opt_bin" {{- /* verify cri-tools checksum */}} diff --git a/deploy/osps/default/osp-sles.yaml b/deploy/osps/default/osp-sles.yaml index 6fc365a7..71929fcf 100644 --- a/deploy/osps/default/osp-sles.yaml +++ b/deploy/osps/default/osp-sles.yaml @@ -20,7 +20,7 @@ metadata: spec: osName: sles osVersion: "15-SP-1" - version: "v0.1.0" + version: "v0.1.1" supportedCloudProviders: - name: aws supportedContainerRuntimes: @@ -69,7 +69,7 @@ spec: fi {{- /* # CNI variables */}} - CNI_VERSION="${CNI_VERSION:-v0.8.7}" + CNI_VERSION="${CNI_VERSION:-v1.2.0}" cni_base_url="https://github.com/containernetworking/plugins/releases/download/$CNI_VERSION" cni_filename="cni-plugins-linux-$arch-$CNI_VERSION.tgz" @@ -89,7 +89,7 @@ spec: cd - {{- /* # cri-tools variables */}} - CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.22.0}" + CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.26.0}" cri_tools_base_url="https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_TOOLS_RELEASE}" cri_tools_filename="crictl-${CRI_TOOLS_RELEASE}-linux-${arch}.tar.gz" @@ -97,8 +97,9 @@ spec: curl -Lfo "$opt_bin/$cri_tools_filename" "$cri_tools_base_url/$cri_tools_filename" {{- /* download cri-tools checksum */}} - {{- /* the cri-tools checksum file has a filename prefix that breaks sha256sum so we need to drop it with sed */}} - cri_tools_sum=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256" | sed 's/\*\///') + {{- /* the cri-tools checksum file provides only the checksum without the file name, so we need to handle it specially */}} + cri_tools_sum_value=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256") + cri_tools_sum="$cri_tools_sum_value $cri_tools_filename" cd "$opt_bin" {{- /* verify cri-tools checksum */}} diff --git a/deploy/osps/default/osp-ubuntu.yaml b/deploy/osps/default/osp-ubuntu.yaml index d3807d2c..cd6b1970 100644 --- a/deploy/osps/default/osp-ubuntu.yaml +++ b/deploy/osps/default/osp-ubuntu.yaml @@ -20,7 +20,7 @@ metadata: spec: osName: "ubuntu" osVersion: "20.04" - version: "v0.1.0" + version: "v0.1.1" supportedCloudProviders: - name: "aws" - name: "azure" @@ -75,7 +75,7 @@ spec: EnvironmentFile=-/etc/environment EOF - apt-get install -y --allow-downgrades containerd.io=1.4* + apt-get install -y --allow-downgrades containerd.io=1.6* apt-mark hold containerd.io systemctl daemon-reload @@ -106,9 +106,9 @@ spec: EOF apt-get install --allow-downgrades -y \ - containerd.io=1.4* \ - docker-ce-cli=5:19.03* \ - docker-ce=5:19.03* + containerd.io=1.6* \ + docker-ce-cli=5:20.10* \ + docker-ce=5:20.10* apt-mark hold docker-ce* containerd.io systemctl daemon-reload @@ -143,7 +143,7 @@ spec: fi {{- /* # CNI variables */}} - CNI_VERSION="${CNI_VERSION:-v0.8.7}" + CNI_VERSION="${CNI_VERSION:-v1.2.0}" cni_base_url="https://github.com/containernetworking/plugins/releases/download/$CNI_VERSION" cni_filename="cni-plugins-linux-$arch-$CNI_VERSION.tgz" @@ -163,7 +163,7 @@ spec: cd - {{- /* # cri-tools variables */}} - CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.22.0}" + CRI_TOOLS_RELEASE="${CRI_TOOLS_RELEASE:-v1.26.0}" cri_tools_base_url="https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_TOOLS_RELEASE}" cri_tools_filename="crictl-${CRI_TOOLS_RELEASE}-linux-${arch}.tar.gz" @@ -171,8 +171,9 @@ spec: curl -Lfo "$opt_bin/$cri_tools_filename" "$cri_tools_base_url/$cri_tools_filename" {{- /* download cri-tools checksum */}} - {{- /* the cri-tools checksum file has a filename prefix that breaks sha256sum so we need to drop it with sed */}} - cri_tools_sum=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256" | sed 's/\*\///') + {{- /* the cri-tools checksum file provides only the checksum without the file name, so we need to handle it specially */}} + cri_tools_sum_value=$(curl -Lf "$cri_tools_base_url/$cri_tools_filename.sha256") + cri_tools_sum="$cri_tools_sum_value $cri_tools_filename" cd "$opt_bin" {{- /* verify cri-tools checksum */}} diff --git a/hack/lib.sh b/hack/lib.sh index d3ddb213..489f8cfd 100755 --- a/hack/lib.sh +++ b/hack/lib.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2021 The Operating System Manager contributors. +# Copyright 2022 The Operating System Manager contributors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,6 +21,21 @@ # receives a SIGINT set -o monitor +# Get the operating system +# Possible values are: +# * linux for linux +# * darwin for macOS +# +# usage: +# if [ "${OS}" == "darwin" ]; then +# # do macos stuff +# fi +OS="$(echo $(uname) | tr '[:upper:]' '[:lower:]')" + +worker_name() { + echo "${KUBERMATIC_WORKERNAME:-$(uname -n)}" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]' +} + retry() { # Works only with bash but doesn't fail on other shells start_time=$(date +%s) @@ -55,6 +70,11 @@ actual_retry() { return 0 } +echodate() { + # do not use -Is to keep this compatible with macOS + echo "[$(date +%Y-%m-%dT%H:%M:%S%:z)]" "$@" +} + write_junit() { # Doesn't make any sense if we don't know a testname if [ -z "${TEST_NAME:-}" ]; then return; fi @@ -69,42 +89,52 @@ write_junit() { errors=1 failure='Step failed' fi - TEST_NAME="[Kubermatic] ${TEST_NAME#\[Kubermatic\] }" - cat << EOF > ${ARTIFACTS}/junit.$(echo $TEST_NAME | sed 's/ /_/g').xml + TEST_CLASS="${TEST_CLASS:-Kubermatic}" + cat << EOF > ${ARTIFACTS}/junit.$(echo $TEST_NAME | sed 's/ /_/g' | tr '[:upper:]' '[:lower:]').xml - - - $failure - - + + + $failure + + EOF } -echodate() { - # do not use -Is to keep this compatible with macOS - echo "[$(date +%Y-%m-%dT%H:%M:%S%:z)]" "$@" +is_containerized() { + # we're inside a Kubernetes pod/container or inside a container launched by containerize() + [ -n "${KUBERNETES_SERVICE_HOST:-}" ] || [ -n "${CONTAINERIZED:-}" ] } containerize() { local cmd="$1" - local image="${CONTAINERIZE_IMAGE:-quay.io/kubermatic/util:1.4.1}" + local image="${CONTAINERIZE_IMAGE:-quay.io/kubermatic/util:2.0.0}" local gocache="${CONTAINERIZE_GOCACHE:-/tmp/.gocache}" + local gomodcache="${CONTAINERIZE_GOMODCACHE:-/tmp/.gomodcache}" + local skip="${NO_CONTAINERIZE:-}" + + # short-circuit containerize when in some cases it needs to be avoided + [ -n "$skip" ] && return - if ! [ -f /.dockerenv ]; then + if ! is_containerized; then echodate "Running $cmd in a Docker container using $image..." + mkdir -p "$gocache" + mkdir -p "$gomodcache" exec docker run \ - -v $PWD:/go/src/k8c.io/operating-system-manager \ - -w /go/src/k8c.io/operating-system-manager \ + -v "$PWD":/go/src/k8c.io/kubermatic \ + -v "$gocache":"$gocache" \ + -v "$gomodcache":"$gomodcache" \ + -w /go/src/k8c.io/kubermatic \ -e "GOCACHE=$gocache" \ + -e "GOMODCACHE=$gomodcache" \ -u "$(id -u):$(id -g)" \ + --entrypoint="$cmd" \ --rm \ -it \ - $image $cmd $@ + $image $@ exit $? fi } -