Skip to content

Commit e0b802b

Browse files
Copilotabdurriq
andcommitted
Extract fallback version to constant at top of file
Co-authored-by: abdurriq <[email protected]>
1 parent 474fcad commit e0b802b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/kubectl-helm-minikube/install.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ set -e
1212
# Clean up
1313
rm -rf /var/lib/apt/lists/*
1414

15+
# Fallback version when stable.txt cannot be fetched (updated: 2026-02)
16+
KUBECTL_FALLBACK_VERSION="v1.28.0"
17+
1518
KUBECTL_VERSION="${VERSION:-"latest"}"
1619
HELM_VERSION="${HELM:-"latest"}"
1720
MINIKUBE_VERSION="${MINIKUBE:-"latest"}" # latest is also valid
@@ -156,10 +159,8 @@ if [ ${KUBECTL_VERSION} != "none" ]; then
156159
if [ "${KUBECTL_VERSION}" = "latest" ] || [ "${KUBECTL_VERSION}" = "lts" ] || [ "${KUBECTL_VERSION}" = "current" ] || [ "${KUBECTL_VERSION}" = "stable" ]; then
157160
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 "")"
158161
if [ -z "${KUBECTL_VERSION}" ]; then
159-
# Fallback to a known stable version when stable.txt cannot be fetched
160-
# Note: This version should be updated periodically to a recent stable release
161-
echo "(!) Failed to fetch kubectl stable version. Using fallback version v1.28.0"
162-
KUBECTL_VERSION="v1.28.0"
162+
echo "(!) Failed to fetch kubectl stable version. Using fallback version ${KUBECTL_FALLBACK_VERSION}"
163+
KUBECTL_VERSION="${KUBECTL_FALLBACK_VERSION}"
163164
fi
164165
else
165166
find_version_from_git_tags KUBECTL_VERSION https://github.com/kubernetes/kubernetes

0 commit comments

Comments
 (0)