Skip to content

Commit

Permalink
gha: Cleanup nydus snapshotter by the daemonset
Browse files Browse the repository at this point in the history
Cleanup nydus snapshotter by the daemonset.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
  • Loading branch information
ChengyuZhu6 committed Feb 7, 2024
1 parent 9b66175 commit 986555e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/integration/kubernetes/gha-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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::"
}

Expand Down Expand Up @@ -299,6 +302,27 @@ 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
kubectl delete -f "misc/snapshotter/nydus-snapshotter-rbac.yaml"
popd

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:-}"
Expand Down

0 comments on commit 986555e

Please sign in to comment.