From 044b944ce1d8564e549e9052d50fe5f222fb84ed Mon Sep 17 00:00:00 2001 From: Yang Chiu Date: Fri, 6 Dec 2024 09:35:06 +0800 Subject: [PATCH] ci: scale up coredns to 3 replicas to prevent it from being affected by node down test cases Signed-off-by: Yang Chiu --- pipelines/e2e/scripts/longhorn-setup.sh | 2 ++ pipelines/utilities/coredns.sh | 7 +++++++ test_framework/scripts/longhorn-setup.sh | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 pipelines/utilities/coredns.sh diff --git a/pipelines/e2e/scripts/longhorn-setup.sh b/pipelines/e2e/scripts/longhorn-setup.sh index 7f7f317bd..591840330 100755 --- a/pipelines/e2e/scripts/longhorn-setup.sh +++ b/pipelines/e2e/scripts/longhorn-setup.sh @@ -55,6 +55,8 @@ main(){ install_backupstores install_csi_snapshotter + scale_up_coredns + # msg="failed to get package manager" error="operating systems amzn are not supported" if [[ "${TF_VAR_k8s_distro_name}" != "eks" ]] && \ [[ "${DISTRO}" != "talos" ]]; then diff --git a/pipelines/utilities/coredns.sh b/pipelines/utilities/coredns.sh new file mode 100644 index 000000000..172c71aa0 --- /dev/null +++ b/pipelines/utilities/coredns.sh @@ -0,0 +1,7 @@ +scale_up_coredns(){ + if [[ "${TF_VAR_k8s_distro_name}" == "rke2" ]]; then + kubectl get configmap -n kube-system rke2-coredns-rke2-coredns-autoscaler -oyaml | sed 's/\"min\": 0/\"min\": 3/' | kubectl apply -n kube-system -f - + else + kubectl patch deployment coredns -n kube-system --type='merge' -p '{"spec": {"replicas": 3}}' + fi +} diff --git a/test_framework/scripts/longhorn-setup.sh b/test_framework/scripts/longhorn-setup.sh index b091c3a9b..66d79baa5 100755 --- a/test_framework/scripts/longhorn-setup.sh +++ b/test_framework/scripts/longhorn-setup.sh @@ -6,6 +6,7 @@ source test_framework/scripts/kubeconfig.sh source pipelines/utilities/longhorn_manifest.sh source pipelines/utilities/longhorn_ui.sh source pipelines/utilities/install_metrics_server.sh +source pipelines/utilities/coredns.sh # create and clean tmpdir TMPDIR="/tmp/longhorn" @@ -563,6 +564,8 @@ main(){ enable_mtls fi + scale_up_coredns + # msg="failed to get package manager" error="operating systems amzn are not supported" if [[ "${TF_VAR_k8s_distro_name}" != "eks" ]] && \ [[ "${DISTRO}" != "talos" ]]; then