From 1918079f81512d0df89e197e1c5fd83b3055bbfa Mon Sep 17 00:00:00 2001 From: Zhecheng Li Date: Mon, 21 Nov 2022 15:47:38 +0800 Subject: [PATCH] [cloud-provider-azure] Support specifying CCM cluster CIDR Signed-off-by: Zhecheng Li --- scripts/ci-entrypoint.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/ci-entrypoint.sh b/scripts/ci-entrypoint.sh index a61fbc27ec9..a4819ea2f0f 100755 --- a/scripts/ci-entrypoint.sh +++ b/scripts/ci-entrypoint.sh @@ -188,6 +188,16 @@ export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}" # create cluster create_cluster +# Get CCM cluster CIDRs from Cluster object if not set +if [[ -z "${CCM_CLUSTER_CIDR:-}" ]]; then + CIDR0=$(${KUBECTL} get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[0]}') + CCM_CLUSTER_CIDR="${CIDR0}" + if CIDR1=$(${KUBECTL} get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[1]}'); then + CCM_CLUSTER_CIDR="${CCM_CLUSTER_CIDR:-}\,${CIDR1}" + fi +fi +echo "CCM cluster CIDR: ${CCM_CLUSTER_CIDR:-}" + # export the target cluster KUBECONFIG if not already set export KUBECONFIG="${KUBECONFIG:-${PWD}/kubeconfig}" @@ -225,7 +235,8 @@ if [[ -n "${TEST_CCM:-}" ]]; then --set cloudControllerManager.enableDynamicReloading="${ENABLE_DYNAMIC_RELOADING}" \ --set cloudControllerManager.cloudConfig="${CLOUD_CONFIG}" \ --set cloudControllerManager.cloudConfigSecretName="${CONFIG_SECRET_NAME}" \ - --set cloudControllerManager.logVerbosity="${CCM_LOG_VERBOSITY}" + --set cloudControllerManager.logVerbosity="${CCM_LOG_VERBOSITY}" \ + --set-string cloudControllerManager.clusterCIDR="${CCM_CLUSTER_CIDR}" echo "Waiting for all kube-system pods to be ready" "${KUBECTL}" wait --for=condition=Ready pod -n kube-system --all --timeout=10m