Skip to content

Commit 943bddc

Browse files
authored
Merge pull request #2876 from k8s-infra-cherrypick-robot/cherry-pick-2837-to-release-1.6
[release-1.6] [cloud-provider-azure] Support specifying CCM cluster CIDR
2 parents d74252c + f4ee5ca commit 943bddc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/ci-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
188188
# create cluster
189189
create_cluster
190190

191+
# Get CCM cluster CIDRs from Cluster object if not set
192+
if [[ -z "${CCM_CLUSTER_CIDR:-}" ]]; then
193+
CCM_CLUSTER_CIDR=$(${KUBECTL} get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[0]}')
194+
if CIDR1=$(${KUBECTL} get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[1]}' 2> /dev/null); then
195+
CCM_CLUSTER_CIDR="${CCM_CLUSTER_CIDR:-}\,${CIDR1}"
196+
fi
197+
fi
198+
echo "CCM cluster CIDR: ${CCM_CLUSTER_CIDR:-}"
199+
191200
# export the target cluster KUBECONFIG if not already set
192201
export KUBECONFIG="${KUBECONFIG:-${PWD}/kubeconfig}"
193202

@@ -225,7 +234,8 @@ if [[ -n "${TEST_CCM:-}" ]]; then
225234
--set cloudControllerManager.enableDynamicReloading="${ENABLE_DYNAMIC_RELOADING}" \
226235
--set cloudControllerManager.cloudConfig="${CLOUD_CONFIG}" \
227236
--set cloudControllerManager.cloudConfigSecretName="${CONFIG_SECRET_NAME}" \
228-
--set cloudControllerManager.logVerbosity="${CCM_LOG_VERBOSITY}"
237+
--set cloudControllerManager.logVerbosity="${CCM_LOG_VERBOSITY}" \
238+
--set-string cloudControllerManager.clusterCIDR="${CCM_CLUSTER_CIDR}"
229239

230240
echo "Waiting for all kube-system pods to be ready"
231241
"${KUBECTL}" wait --for=condition=Ready pod -n kube-system --all --timeout=10m

0 commit comments

Comments
 (0)