From 97fbf360cc84d00e0541e34356490f2a4eaacffc Mon Sep 17 00:00:00 2001 From: ChengyuZhu6 Date: Thu, 14 Dec 2023 14:29:15 +0800 Subject: [PATCH] gha: Cleanup nydus snapshotter by the daemonset Cleanup nydus snapshotter by the daemonset. Signed-off-by: ChengyuZhu6 --- tests/integration/kubernetes/gha-run.sh | 29 ++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index 7f9888f19..9828d3377 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -251,7 +251,10 @@ function deploy_snapshotter() { function cleanup_snapshotter() { echo "::group::Cleanuping ${SNAPSHOTTER}" - #TODO Add the logic for cleaning up the snapshotter in PR https://github.com/kata-containers/kata-containers/pull/8585. + case ${SNAPSHOTTER} in + nydus) cleanup_nydus_snapshotter ;; + *) >&2 echo "${SNAPSHOTTER} flavour is not supported"; exit 2 ;; + esac echo "::endgroup::" } @@ -302,6 +305,30 @@ function deploy_nydus_snapshotter() { echo "::endgroup::" } +function cleanup_nydus_snapshotter() { + echo "cleanup_nydus_snapshotter" + local nydus_snapshotter_install_dir="/tmp/nydus-snapshotter" + if [ ! -d "${nydus_snapshotter_install_dir}" ]; then + >&2 echo "nydus snapshotter dir not found" + exit 1 + fi + + pushd "$nydus_snapshotter_install_dir" + + if [ "${KUBERNETES}" = "k3s" ]; then + kubectl delete -k "misc/snapshotter/overlays/k3s" + else + kubectl delete -f "misc/snapshotter/base/nydus-snapshotter.yaml" + fi + sleep 180s + kubectl delete -f "misc/snapshotter/nydus-snapshotter-rbac.yaml" + popd + sleep 30s + + rm -rf "${nydus_snapshotter_install_dir}" + echo "::endgroup::" +} + function main() { export KATA_HOST_OS="${KATA_HOST_OS:-}" export K8S_TEST_HOST_TYPE="${K8S_TEST_HOST_TYPE:-}"