Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ if [[ "$PATH" != *:/usr/sbin && "$PATH" != *:/usr/sbin:* ]]; then
export PATH=$PATH:/usr/sbin
fi

# Restarting containerd and kubelet can restart the API server: retry while it is down or refuses requests
APPLY_ATTEMPT_TIMEOUT=90
APPLY_RETRY_TIMEOUT=180
APPLY_RETRY_SLEEP=10
apply_manifest() {
local deadline=$((SECONDS + APPLY_RETRY_TIMEOUT))
until timeout -k 10 ${APPLY_ATTEMPT_TIMEOUT} /opt/bin/kubectl apply -f "$1"; do
if [ $((SECONDS + APPLY_RETRY_SLEEP)) -ge $deadline ]; then
echo "ERROR: Unable to apply $1"
return 1
fi
echo "Unable to apply $1, retrying in ${APPLY_RETRY_SLEEP} seconds"
sleep ${APPLY_RETRY_SLEEP}
done
}

ISO_MOUNT_DIR=/mnt/k8sdisk
BINARIES_DIR=${ISO_MOUNT_DIR}/

Expand Down Expand Up @@ -149,9 +165,9 @@ if [ -d "$BINARIES_DIR" ]; then

if [ "${IS_MAIN_CONTROL}" == 'true' ]; then
if [[ ${EXTERNAL_CNI} == true ]]; then
/opt/bin/kubectl apply -f ${BINARIES_DIR}/network.yaml
apply_manifest ${BINARIES_DIR}/network.yaml
fi
/opt/bin/kubectl apply -f ${BINARIES_DIR}/dashboard.yaml
apply_manifest ${BINARIES_DIR}/dashboard.yaml
fi

umount "${ISO_MOUNT_DIR}" && rmdir "${ISO_MOUNT_DIR}"
Expand Down
Loading