mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 07:48:55 +00:00
gha: kata-deploy: Do the runtime class cleanup as part of the cleanup
Instead of doing this as part of the test itself, let's ensure it's done before running the tests and during the tests cleanup. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
4ffc2c86f3
commit
2d896ad12f
@ -13,11 +13,34 @@ kata_deploy_dir="$(dirname "$(readlink -f "$0")")"
|
||||
source "${kata_deploy_dir}/../../gha-run-k8s-common.sh"
|
||||
|
||||
function run_tests() {
|
||||
cleanup_runtimeclasses || true
|
||||
|
||||
pushd "${kata_deploy_dir}"
|
||||
bash run-kata-deploy-tests.sh
|
||||
popd
|
||||
}
|
||||
|
||||
function cleanup_runtimeclasses() {
|
||||
# Cleanup any runtime class that was left behind in the cluster, in
|
||||
# case of a test failure, apart from the default one that comes from
|
||||
# AKS
|
||||
for rc in `kubectl get runtimeclass -o name | grep -v "kata-mshv-vm-isolation" | sed 's|runtimeclass.node.k8s.io/||'`
|
||||
do
|
||||
kubectl delete runtimeclass $rc;
|
||||
done
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
platform="${1}"
|
||||
test_type="${2:-k8s}"
|
||||
|
||||
cleanup_runtimeclasses || true
|
||||
|
||||
if [ "${platform}" = "aks" ]; then
|
||||
delete_cluster ${test_type}
|
||||
fi
|
||||
}
|
||||
|
||||
function main() {
|
||||
export KATA_HOST_OS="${KATA_HOST_OS:-}"
|
||||
|
||||
|
@ -11,12 +11,6 @@ setup() {
|
||||
repo_root_dir="${BATS_TEST_DIRNAME}/../../../"
|
||||
ensure_yq
|
||||
|
||||
# Cleanup any runtimeclass already present in the cluster
|
||||
# apart from the default one that comes from AKS
|
||||
for rc in `kubectl get runtimeclass -o name | grep -v "kata-mshv-vm-isolation" | sed 's|runtimeclass.node.k8s.io/||'`; do
|
||||
kubectl delete runtimeclass $rc;
|
||||
done
|
||||
|
||||
# We expect 2 runtime classes because:
|
||||
# * `kata` is the default runtimeclass created, basically an alias for `kata-${KATA_HYPERVISOR}`.
|
||||
# * `kata-${KATA_HYPERVISOR}` is the other one
|
||||
@ -109,11 +103,4 @@ teardown() {
|
||||
|
||||
kubectl delete ${cleanup_spec}
|
||||
kubectl delete -f "${repo_root_dir}/tools/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml"
|
||||
|
||||
# Cleanup any runtime class that was left behind in the cluster, in
|
||||
# case of a test failure, apart from the default one that comes from
|
||||
# AKS
|
||||
for rc in `kubectl get runtimeclass -o name | grep -v "kata-mshv-vm-isolation" | sed 's|runtimeclass.node.k8s.io/||'`; do
|
||||
kubectl delete runtimeclass $rc;
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user