Skip to content

Commit 59c619d

Browse files
Copilotabdurriq
andcommitted
Add alternative URL fallback before using hardcoded version
Co-authored-by: abdurriq <[email protected]>
1 parent 1fd44a2 commit 59c619d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/kubectl-helm-minikube/install.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ if [ ${KUBECTL_VERSION} != "none" ]; then
159159
if [ "${KUBECTL_VERSION}" = "latest" ] || [ "${KUBECTL_VERSION}" = "lts" ] || [ "${KUBECTL_VERSION}" = "current" ] || [ "${KUBECTL_VERSION}" = "stable" ]; then
160160
KUBECTL_VERSION="$(curl -fsSL --connect-timeout 10 --max-time 30 https://dl.k8s.io/release/stable.txt 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' || echo "")"
161161
if [ -z "${KUBECTL_VERSION}" ]; then
162-
echo "(!) Failed to fetch kubectl stable version. Using fallback version ${KUBECTL_FALLBACK_VERSION}"
162+
echo "(!) Failed to fetch kubectl stable version from dl.k8s.io, trying alternative URL..."
163+
KUBECTL_VERSION="$(curl -fsSL --connect-timeout 10 --max-time 30 https://storage.googleapis.com/kubernetes-release/release/stable.txt 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' || echo "")"
164+
fi
165+
if [ -z "${KUBECTL_VERSION}" ]; then
166+
echo "(!) Failed to fetch kubectl stable version from both URLs. Using fallback version ${KUBECTL_FALLBACK_VERSION}"
163167
KUBECTL_VERSION="${KUBECTL_FALLBACK_VERSION}"
164168
fi
165169
else

0 commit comments

Comments
 (0)