diff --git a/tests/gha-run-k8s-common.sh b/tests/gha-run-k8s-common.sh index cbd79c01c4..5b8193c88f 100644 --- a/tests/gha-run-k8s-common.sh +++ b/tests/gha-run-k8s-common.sh @@ -13,11 +13,25 @@ source "${tests_dir}/common.bash" K8S_TEST_HOST_TYPE="${K8S_TEST_HOST_TYPE:-small}" +function _print_instance_type() { + case ${K8S_TEST_HOST_TYPE} in + small) + echo "Standard_D2s_v5" + ;; + normal) + echo "Standard_D4s_v5" + ;; + *) + echo "Unknown instance type '${K8S_TEST_HOST_TYPE}'" >&2 + exit 1 + esac +} + function _print_cluster_name() { test_type="${1:-k8s}" short_sha="$(git rev-parse --short=12 HEAD)" - echo "${test_type}-${GH_PR_NUMBER}-${short_sha}-${KATA_HYPERVISOR}-${KATA_HOST_OS}-amd64" + echo "${test_type}-${GH_PR_NUMBER}-${short_sha}-${KATA_HYPERVISOR}-${KATA_HOST_OS}-amd64-${K8S_TEST_HOST_TYPE:0:1}" } function _print_rg_name() { @@ -52,21 +66,11 @@ function create_cluster() { -l eastus2 \ -n "${rg}" - local instance_type="" - case ${K8S_TEST_HOST_TYPE} in - small) - instance_type="Standard_D2s_v5" - ;; - normal) - instance_type="Standard_D4s_v5" - ;; - esac - az aks create \ -g "${rg}" \ --node-resource-group "node-${rg}" \ -n "$(_print_cluster_name ${test_type})" \ - -s "${instance_type}" \ + -s "$(_print_instance_type)" \ --node-count 1 \ --generate-ssh-keys \ $([ "${KATA_HOST_OS}" = "cbl-mariner" ] && echo "--os-sku AzureLinux --workload-runtime KataMshvVmIsolation")