Skip to content

Commit 1e8985d

Browse files
Automator: update common-files@master in istio/api@master (#3085)
1 parent a3fe407 commit 1e8985d

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

Diff for: common/.commonfiles.sha

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
99342562311d5b78d65e06633d5dfe9fc4079935
1+
5f3aa45827fefc83b8cc52149075e461734bcf15

Diff for: common/scripts/kind_provisioner.sh

+39-1
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,41 @@ EOF
182182
fi
183183
fi
184184

185+
KIND_WAIT_FLAG="--wait=180s"
186+
KIND_DISABLE_CNI="false"
187+
if [[ -n "${KUBERNETES_CNI:-}" ]]; then
188+
unset KIND_WAIT_FLAG
189+
KIND_DISABLE_CNI="true"
190+
fi
191+
185192
# Create KinD cluster
186-
if ! (kind create cluster --name="${NAME}" --config "${CONFIG}" -v4 --retain --image "${IMAGE}" --wait=180s); then
193+
if ! (yq eval "${CONFIG}" --expression ".networking.disableDefaultCNI = ${KIND_DISABLE_CNI}" | \
194+
kind create cluster --name="${NAME}" -v4 --retain --image "${IMAGE}" ${KIND_WAIT_FLAG:+"$KIND_WAIT_FLAG"} --config -); then
187195
echo "Could not setup KinD environment. Something wrong with KinD setup. Exporting logs."
188196
return 9
189197
fi
190198
# Workaround kind issue causing taints to not be removed in 1.24
191199
kubectl taint nodes "${NAME}"-control-plane node-role.kubernetes.io/control-plane- || true
192200

201+
# Determine what CNI to install
202+
case "${KUBERNETES_CNI:-}" in
203+
204+
"calico")
205+
echo "Installing Calico CNI"
206+
install_calico "" "$(dirname "$CONFIG")"
207+
;;
208+
209+
"")
210+
# perfectly fine, we accepted the default KinD CNI
211+
;;
212+
213+
*)
214+
# we don't know what to do but we've got no CNI, return non-zero
215+
echo "${KUBERNETES_CNI} is not recognized. Supported options are \"calico\" or do not set the variable to use default."
216+
return 1
217+
;;
218+
esac
219+
193220
# If metrics server configuration directory is specified then deploy in
194221
# the cluster just created
195222
if [[ -n ${METRICS_SERVER_CONFIG_DIR:-} ]]; then
@@ -362,6 +389,17 @@ function connect_kind_clusters() {
362389
fi
363390
}
364391

392+
function install_calico {
393+
local KUBECONFIG="${1}"
394+
local CONFIG_DIR="${2}"
395+
396+
echo "Setting up ambient cluster, Calico CNI will be used."
397+
kubectl --kubeconfig="$KUBECONFIG" apply -f "${CONFIG_DIR}"/calico.yaml
398+
399+
kubectl --kubeconfig="$KUBECONFIG" wait --for condition=ready -n kube-system pod -l k8s-app=calico-node --timeout 90s
400+
kubectl --kubeconfig="$KUBECONFIG" wait --for condition=ready -n kube-system pod -l k8s-app=calico-kube-controllers --timeout 90s
401+
}
402+
365403
function install_metallb() {
366404
KUBECONFIG="${1}"
367405
kubectl --kubeconfig="$KUBECONFIG" apply -f "${COMMON_SCRIPTS}/metallb-native.yaml"

0 commit comments

Comments
 (0)