mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
tests: k8s: Allow using custom resource group
This simply allows setting a custom resource group when debugging locally, so as to prevent name collisions and not pollute the namespace. Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
parent
350f3f70b7
commit
4703434b12
@ -12,6 +12,8 @@ kubernetes_dir="$(dirname "$(readlink -f "$0")")"
|
|||||||
source "${kubernetes_dir}/../../common.bash"
|
source "${kubernetes_dir}/../../common.bash"
|
||||||
tools_dir="${repo_root_dir}/tools"
|
tools_dir="${repo_root_dir}/tools"
|
||||||
|
|
||||||
|
AZ_RG="${AZ_RG:-kataCI}"
|
||||||
|
|
||||||
function _print_cluster_name() {
|
function _print_cluster_name() {
|
||||||
short_sha="$(git rev-parse --short=12 HEAD)"
|
short_sha="$(git rev-parse --short=12 HEAD)"
|
||||||
echo "${GH_PR_NUMBER}-${short_sha}-${KATA_HYPERVISOR}-${KATA_HOST_OS}-amd64"
|
echo "${GH_PR_NUMBER}-${short_sha}-${KATA_HYPERVISOR}-${KATA_HOST_OS}-amd64"
|
||||||
@ -36,7 +38,7 @@ function create_cluster() {
|
|||||||
delete_cluster || true
|
delete_cluster || true
|
||||||
|
|
||||||
az aks create \
|
az aks create \
|
||||||
-g "kataCI" \
|
-g "${AZ_RG}" \
|
||||||
-n "$(_print_cluster_name)" \
|
-n "$(_print_cluster_name)" \
|
||||||
-s "Standard_D4s_v5" \
|
-s "Standard_D4s_v5" \
|
||||||
--node-count 1 \
|
--node-count 1 \
|
||||||
@ -55,7 +57,7 @@ function install_kubectl() {
|
|||||||
|
|
||||||
function get_cluster_credentials() {
|
function get_cluster_credentials() {
|
||||||
az aks get-credentials \
|
az aks get-credentials \
|
||||||
-g "kataCI" \
|
-g "${AZ_RG}" \
|
||||||
-n "$(_print_cluster_name)"
|
-n "$(_print_cluster_name)"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +158,7 @@ function cleanup() {
|
|||||||
|
|
||||||
function delete_cluster() {
|
function delete_cluster() {
|
||||||
az aks delete \
|
az aks delete \
|
||||||
-g "kataCI" \
|
-g "${AZ_RG}" \
|
||||||
-n "$(_print_cluster_name)" \
|
-n "$(_print_cluster_name)" \
|
||||||
--yes
|
--yes
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user