diff --git a/.github/workflows/run-kata-deploy-tests-on-garm.yaml b/.github/workflows/run-kata-deploy-tests-on-garm.yaml index 4bfe660c4f..ce2ebf5403 100644 --- a/.github/workflows/run-kata-deploy-tests-on-garm.yaml +++ b/.github/workflows/run-kata-deploy-tests-on-garm.yaml @@ -34,6 +34,7 @@ jobs: - k0s - k3s - rke2 + - microk8s # TODO: There are a couple of vmm/k8s combination failing (https://github.com/kata-containers/kata-containers/issues/9854) # and we will put the entire kata-deploy-tests on GARM on maintenance. # TODO: Transition to free runner (see #9940). diff --git a/tests/functional/kata-deploy/kata-deploy.bats b/tests/functional/kata-deploy/kata-deploy.bats index 096df051fe..94b378d4d0 100644 --- a/tests/functional/kata-deploy/kata-deploy.bats +++ b/tests/functional/kata-deploy/kata-deploy.bats @@ -72,6 +72,8 @@ setup() { kubectl apply -k "tools/packaging/kata-deploy/kata-deploy/overlays/k3s" elif [ "${KUBERNETES}" = "rke2" ]; then kubectl apply -k "tools/packaging/kata-deploy/kata-deploy/overlays/rke2" + elif [ "${KUBERNETES}" = "microk8s" ]; then + kubectl apply -k "tools/packaging/kata-deploy/kata-deploy/overlays/microk8s" else kubectl apply -f "tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" fi @@ -142,6 +144,9 @@ teardown() { elif [ "${KUBERNETES}" = "rke2" ]; then deploy_spec="-k \"tools/packaging/kata-deploy/kata-deploy/overlays/rke2\"" cleanup_spec="-k \"tools/packaging/kata-deploy/kata-cleanup/overlays/rke2\"" + elif [ "${KUBERNETES}" = "microk8s" ]; then + deploy_spec="-k \"tools/packaging/kata-deploy/kata-deploy/overlays/microk8s\"" + cleanup_spec="-k \"tools/packaging/kata-deploy/kata-cleanup/overlays/microk8s\"" else deploy_spec="-f \"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml\"" cleanup_spec="-f \"tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml\"" diff --git a/tests/gha-run-k8s-common.sh b/tests/gha-run-k8s-common.sh index 4df12ee816..dcea96a264 100644 --- a/tests/gha-run-k8s-common.sh +++ b/tests/gha-run-k8s-common.sh @@ -323,6 +323,26 @@ function deploy_rke2() { sudo chown ${USER}:${USER} ~/.kube/config } +function deploy_microk8s() { + sudo snap install microk8s --classic + + # These are arbitrary values + sleep 30 + sudo /snap/bin/microk8s.status --wait-ready --timeout 300 + + # install kubectl + ARCH=$(arch_to_golang) + kubectl_version=$(/snap/bin/microk8s.version | grep -oe 'v[0-9]\+\(\.[0-9]\+\)*') + sudo curl -fL --progress-bar -o /usr/bin/kubectl https://dl.k8s.io/release/${kubectl_version}/bin/linux/${ARCH}/kubectl + sudo chmod +x /usr/bin/kubectl + sudo rm -rf /usr/local/bin/kubectl + + mkdir -p ~/.kube + sudo /snap/bin/microk8s.config > ~/.kube/config + sudo chown ${USER}:${USER} ~/.kube/config + newgrp microk8s +} + function _get_k0s_kubernetes_version_for_crio() { # k0s version will look like: # v1.27.5+k0s.0 @@ -358,6 +378,7 @@ function deploy_k8s() { k0s) deploy_k0s ;; k3s) deploy_k3s ;; rke2) deploy_rke2 ;; + microk8s) deploy_microk8s ;; *) >&2 echo "${KUBERNETES} flavour is not supported"; exit 2 ;; esac