From a41a56e326414497d5b07814f59cf5cb85057da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 5 Sep 2023 16:18:34 +0200 Subject: [PATCH] ci: k8s: Add a function to configure devmapper for containerd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function right now is completely based on what's part of the tests repo[0], and that's the reason I'm keeping the `Signed-off-by` of all the contributors to that file. This is not perfect, though, as it changes the default snapshotter to devmapper, instead of only doing so for the Kata Containers specific runtime handlers. OTOH, this is exactly what we've always been doing as part of the tests. We'll improve it, soon enough, when we get to also add a way for kata-deploy to set up different snapshotters for different handlers. But, for now, this is as good (or as bad) as it's always been. It's important to note that the devmapper setup doesn't take into consideration a BM machine, and this is not suitable for that. We're really only targetting GHA runners which will be thrown away after the run is over. Signed-off-by: Fabiano FidĂȘncio Signed-off-by: Shiming Zhang Signed-off-by: Marcel Apfelbaum Signed-off-by: Gabriela Cervantes (cherry picked from commit b28b54df04be36ac7a1c940320cefacbd572597c) --- tests/integration/kubernetes/gha-run.sh | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index 70982121ab..2df72ac23f 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -12,6 +12,78 @@ kubernetes_dir="$(dirname "$(readlink -f "$0")")" source "${kubernetes_dir}/../../gha-run-k8s-common.sh" tools_dir="${repo_root_dir}/tools" +function configure_devmapper() { + sudo mkdir -p /var/lib/containerd/devmapper + sudo truncate --size 10G /var/lib/containerd/devmapper/data-disk.img + sudo truncate --size 10G /var/lib/containerd/devmapper/meta-disk.img + + cat<&2 echo "${KUBERNETES} flavour is not supported"; exit 2 ;; + esac + + # We're not using this with baremetal machines, so we're fine on cutting + # corners here and just append this to the configuration file. + cat<&2 echo "${KUBERNETES} flavour is not supported"; exit 2 ;; + esac +} + +function configure_snapshotter() { + echo "::group::Configuring ${SNAPSHOTTER}" + + case ${SNAPSHOTTER} in + devmapper) configure_devmapper ;; + *) >&2 echo "${SNAPSHOTTER} flavour is not supported"; exit 2 ;; + esac + + echo "::endgroup::" +} + function deploy_kata() { platform="${1}" ensure_yq @@ -144,6 +216,7 @@ function main() { install-azure-cli) install_azure_cli ;; login-azure) login_azure ;; create-cluster) create_cluster ;; + configure-snapshotter) configure_snapshotter ;; deploy-k8s) deploy_k8s ;; install-bats) install_bats ;; install-kubectl) install_kubectl ;;