gha: Cleanup nydus snapshotter by the daemonset

Cleanup nydus snapshotter by the daemonset.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
This commit is contained in:
ChengyuZhu6 2023-12-14 14:29:15 +08:00 committed by Fabiano Fidêncio
parent 43b04fd0c0
commit 97fbf360cc
No known key found for this signature in database
GPG Key ID: EE926C2BDACC177B

View File

@ -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:-}"