File tree Expand file tree Collapse file tree
src/kubectl-helm-minikube Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,10 +154,18 @@ if [ ${KUBECTL_VERSION} != "none" ]; then
154154 # Install the kubectl, verify checksum
155155 echo " Downloading kubectl..."
156156 if [ " ${KUBECTL_VERSION} " = " latest" ] || [ " ${KUBECTL_VERSION} " = " lts" ] || [ " ${KUBECTL_VERSION} " = " current" ] || [ " ${KUBECTL_VERSION} " = " stable" ]; then
157- KUBECTL_VERSION=" $( curl -sSL https://dl.k8s.io/release/stable.txt) "
157+ KUBECTL_VERSION=" $( curl -fsSL --connect-timeout 10 --max-time 30 https://dl.k8s.io/release/stable.txt 2> /dev/null || echo " " ) "
158+ if [ -z " ${KUBECTL_VERSION} " ]; then
159+ echo " (!) Failed to fetch kubectl stable version, falling back to version discovery via git tags"
160+ find_version_from_git_tags KUBECTL_VERSION https://github.com/kubernetes/kubernetes
161+ fi
158162 else
159163 find_version_from_git_tags KUBECTL_VERSION https://github.com/kubernetes/kubernetes
160164 fi
165+ if [ -z " ${KUBECTL_VERSION} " ] || [ " ${KUBECTL_VERSION} " = " none" ]; then
166+ echo " (!) Failed to determine kubectl version"
167+ exit 1
168+ fi
161169 if [ " ${KUBECTL_VERSION:: 1} " != ' v' ]; then
162170 KUBECTL_VERSION=" v${KUBECTL_VERSION} "
163171 fi
You can’t perform that action at this time.
0 commit comments