test/e2e/dra: fix kind cluster creation

The nightly containerd binary no longer works in the current kind base images:

   May 15 16:32:31 kind-worker containerd[222]: /usr/local/bin/containerd:
   /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by
   /usr/local/bin/containerd)

kind now builds containerd directly with the base images. The official base
images still use containerd 1.6, so we have to use a special base image that
was prepared for this purpose.

Because the containerd config can be patched through kind, we don't need to
modify the generated node image anymore.
This commit is contained in:
Patrick Ohly 2023-05-16 08:11:43 +02:00
parent f70c26d495
commit 073b4cf66a
2 changed files with 10 additions and 25 deletions

View File

@ -23,30 +23,9 @@ set -ex
set -o pipefail set -o pipefail
tag="$1" tag="$1"
containerd="containerd-1.7.0-79-g2503bef58" # from https://github.com/kind-ci/containerd-nightlies/releases
tmpdir="$(mktemp -d)" # Created manually in the kind repo by bentheelder with
cleanup() { # make -C images/base push EXTRA_BUILD_OPT=--build-arg=CONTAINERD_VERSION=v1.7.1 TAG=$(date +v%Y%m%d)-$(git describe --always --dirty)-containerd_v1.7.1
rm -rf "$tmpdir" base_image="gcr.io/k8s-staging-kind/base:v20230515-01914134-containerd_v1.7.1@sha256:468fc430a6848884b786c5cd2f1c03e7a0977f04fb129a2cda2a19ec986ddacb"
}
trap cleanup EXIT
goarch=$(go env GOARCH) kind build node-image --base-image "$base_image" --image "$tag" "$(pwd)"
kind build node-image --image "$tag" "$(pwd)"
curl -L --silent https://github.com/kind-ci/containerd-nightlies/releases/download/$containerd/$containerd-linux-"$goarch".tar.gz | tar -C "$tmpdir" -vzxf -
curl -L --silent https://github.com/kind-ci/containerd-nightlies/releases/download/$containerd/runc."$goarch" >"$tmpdir/runc"
cat >"$tmpdir/Dockerfile" <<EOF
FROM $tag
COPY bin/* /usr/local/bin/
RUN chmod a+rx /usr/local/bin/*
COPY runc /usr/local/sbin
RUN chmod a+rx /usr/local/sbin/runc
# Enable CDI as described in https://github.com/container-orchestrated-devices/container-device-interface#containerd-configuration
RUN sed -i -e '/\[plugins."io.containerd.grpc.v1.cri"\]/a \ \ enable_cdi = true' /etc/containerd/config.toml
EOF
docker build --tag "$tag" "$tmpdir"

View File

@ -1,5 +1,11 @@
kind: Cluster kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4 apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
# Enable CDI as described in
# https://github.com/container-orchestrated-devices/container-device-interface#containerd-configuration
- |-
[plugins."io.containerd.grpc.v1.cri"]
enable_cdi = true
nodes: nodes:
- role: control-plane - role: control-plane
kubeadmConfigPatches: kubeadmConfigPatches: