From b19db40343771daf2ae68dd2c5841be6870ae3df Mon Sep 17 00:00:00 2001 From: Fupan Li Date: Tue, 17 Dec 2024 12:05:46 +0800 Subject: [PATCH] CI: change the containerd tarball name to containerd Since from https://github.com/containerd/containerd/pull/9096 containerd removed cri-containerd-*.tar.gz release bundles, thus we'd better change the tarball name to "containerd". BTW, the containerd tarball containerd the follow files: bin/ bin/containerd-shim bin/ctr bin/containerd-shim-runc-v1 bin/containerd-stress bin/containerd bin/containerd-shim-runc-v2 thus we should untar containerd into /usr/local directory instead of "/" to keep align with the cri-containerd. In addition, there's no containerd.service file,runc binary and cni-plugin included, thus we should add a specific containerd.service file and install install the runc binary and cni-pluginspecifically. Signed-off-by: Fupan Li --- tests/common.bash | 100 +++++++++++++++++++- tests/functional/kata-monitor/gha-run.sh | 2 + tests/integration/cri-containerd/gha-run.sh | 2 + tests/integration/nydus/gha-run.sh | 2 + tests/integration/runk/gha-run.sh | 2 + tests/integration/stdio/gha-run.sh | 2 + versions.yaml | 5 + 7 files changed, 113 insertions(+), 2 deletions(-) diff --git a/tests/common.bash b/tests/common.bash index ca8b59bbff..727901a2cf 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -619,6 +619,63 @@ function install_cni_plugins() { sudo mkdir -p /opt/cni/bin sudo tar -xvf "${tarball_name}" -C /opt/cni/bin rm -f "${tarball_name}" + + cni_config="/etc/cni/net.d/10-containerd-net.conflist" + if [ ! -f ${cni_config} ];then + sudo mkdir -p /etc/cni/net.d + sudo tee "${cni_config}" << EOF +{ + "cniVersion": "1.0.0", + "name": "containerd-net", + "plugins": [ + { + "type": "bridge", + "bridge": "cni0", + "isGateway": true, + "ipMasq": true, + "promiscMode": true, + "ipam": { + "type": "host-local", + "ranges": [ + [{ + "subnet": "10.88.0.0/16" + }], + [{ + "subnet": "2001:4860:4860::/64" + }] + ], + "routes": [ + { "dst": "0.0.0.0/0" }, + { "dst": "::/0" } + ] + } + }, + { + "type": "portmap", + "capabilities": {"portMappings": true} + } + ] +} +EOF + fi +} + +# version: The version to be installed +function install_runc() { + base_version="${1}" + project="opencontainers/runc" + version=$(get_latest_patch_release_from_a_github_project "${project}" "${base_version}") + + if [ -f /usr/local/sbin/runc ]; then + return + fi + + binary_name="runc.$(${repo_root_dir}/tests/kata-arch.sh -g)" + download_github_project_tarball "${project}" "${version}" "${binary_name}" + + sudo mkdir -p /usr/local/sbin + sudo mv $binary_name /usr/local/sbin/runc + sudo chmod +x /usr/local/sbin/runc } # base_version: The version to be intalled in the ${major}.${minor} format @@ -628,14 +685,53 @@ function install_cri_containerd() { project="containerd/containerd" version=$(get_latest_patch_release_from_a_github_project "${project}" "${base_version}") - tarball_name="cri-containerd-cni-${version//v}-linux-$(${repo_root_dir}/tests/kata-arch.sh -g).tar.gz" + tarball_name="containerd-${version//v}-linux-$(${repo_root_dir}/tests/kata-arch.sh -g).tar.gz" download_github_project_tarball "${project}" "${version}" "${tarball_name}" - sudo tar -xvf "${tarball_name}" -C / + #add the "--keep-directory-symlink" option to make sure the untar wouldn't override the + #system rootfs's bin/sbin directory which would be a symbol link to /usr/bin or /usr/sbin. + if [ ! -f /usr/local ]; then + sudo mkdir -p /usr/local + fi + sudo tar --keep-directory-symlink -xvf "${tarball_name}" -C /usr/local/ rm -f "${tarball_name}" sudo mkdir -p /etc/containerd containerd config default | sudo tee /etc/containerd/config.toml + + containerd_service="/etc/systemd/system/containerd.service" + + if [ ! -f ${containerd_service} ]; then + sudo mkdir -p /etc/systemd/system + sudo tee ${containerd_service} <