From dd3c5fc617e778f1f191e3ab0d4481587b2309d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 18 Feb 2021 00:18:03 +0100 Subject: [PATCH] kata-deploy: Ensure CRI-O uses the VM runtime type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For Kata Containers 2.x, CRI-O should always be using the `containerd-shim-kata-v2` binary, and always be configured to use the "vm" runtime type, developed specifically for the shimv2, instead of the default "oci" runtime type. I've taken the liberty to try to simplify the CRI-O script and make it less error prone. In the future, we can start dropping a configuration file to /etc/crio/crio.conf.d and just removing it as part of the cleanup, but that's for the future. Fixes: #1357 Signed-off-by: Fabiano FidĂȘncio --- .../kata-deploy/scripts/kata-deploy.sh | 106 ++++++------------ 1 file changed, 33 insertions(+), 73 deletions(-) diff --git a/tools/packaging/kata-deploy/scripts/kata-deploy.sh b/tools/packaging/kata-deploy/scripts/kata-deploy.sh index a66c91a0e0..9903495c93 100755 --- a/tools/packaging/kata-deploy/scripts/kata-deploy.sh +++ b/tools/packaging/kata-deploy/scripts/kata-deploy.sh @@ -54,6 +54,8 @@ function install_artifacts() { } function configure_cri_runtime() { + configure_different_shims_base + case $1 in crio) configure_crio @@ -92,7 +94,7 @@ function configure_different_shims_base() { cat << EOT | tee "$shim_file" #!/bin/bash -KATA_CONF_FILE=/opt/kata/share/defaults/kata-containers/configuration-${shim}.toml /opt/kata/bin/containerd-shim-kata-v2 \$@ +KATA_CONF_FILE=/opt/kata/share/defaults/kata-containers/configuration-${shim}.toml /opt/kata/bin/containerd-shim-kata-v2 "\$@" EOT chmod +x "$shim_file" done @@ -112,6 +114,31 @@ function cleanup_different_shims_base() { done } +function configure_crio_runtime() { + local runtime="kata" + if [ -n "${1-}" ]; then + runtime+="-$1" + fi + + local kata_path="/usr/local/bin/containerd-shim-${runtime}-v2" + local kata_conf="crio.runtime.runtimes.${runtime}" + + if grep -qEe "^\[$kata_conf\]" $crio_conf_file; then + echo "Configuration exists $kata_conf, overwriting" + sed -i "/\[$kata_conf\]/\[$kata_conf-original\]/" $crio_conf_file + fi + + cat <