Skip to content

Commit 5ad29c7

Browse files
authored
Merge pull request #6150 from willie-yao/resolve-old-releases
Add static version mapping for EOL Kubernetes releases
2 parents f9c0d25 + 205141e commit 5ad29c7

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

docs/book/src/developers/development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ With the following environment variables defined, you can build a CAPZ cluster f
565565
| Environment Variable | Value |
566566
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
567567
| `E2E_ARGS` | `-kubetest.use-ci-artifacts` |
568-
| `KUBERNETES_VERSION` | `latest` - extract Kubernetes version from https://dl.k8s.io/ci/latest.txt (main's HEAD)<br>`latest-1.<MINOR>` - extract Kubernetes version from dl.k8s.io/ci/latest-1.<MINOR>.txt (release branch's HEAD) |
568+
| `KUBERNETES_VERSION` | `latest` - extract Kubernetes version from https://dl.k8s.io/ci/latest.txt (main's HEAD)<br>`latest-1.<MINOR>` - extract Kubernetes version from dl.k8s.io/ci/latest-1.<MINOR>.txt (release branch's HEAD). For end-of-life minor versions, a static final patch release is returned instead (see `capz::util::get_eol_k8s_version` in `hack/util.sh`). |
569569
| `WINDOWS_SERVER_VERSION` | Optional, can be `windows-2022` (default) or `windows-2025` |
570570
| `KUBETEST_WINDOWS_CONFIG` | Default is `upstream-windows.yaml`. CAPZ contains various other configuration recipes in the `test/e2e/data/` directory; you may use any of those by referencing their file names as the value of `KUBETEST_WINDOWS_CONFIG` (e.g., `conformance-fast.yaml`), or you may drop in your own config files into `test/e2e/data/` and reference those. |
571571
| `WINDOWS_CONTAINERD_URL` | Optional, can be any url to a `tar.gz` file containing binaries for containerd in the same format as upstream package |
@@ -595,7 +595,7 @@ You can optionally set the following variables:
595595
| `AZURE_SSH_PUBLIC_KEY_FILE` | Use your own SSH key. |
596596
| `SKIP_CLEANUP` | Skip deleting the cluster after the tests finish running. |
597597
| `KUBECONFIG` | Provide your existing cluster kubeconfig filepath. If no kubeconfig is provided, `./kubeconfig` will be used. |
598-
| `KUBERNETES_VERSION` | Desired Kubernetes version to test. You can pass in a definitive released version, e.g., "v1.24.0". If you want to use pre-released CI bits of a particular release you may use the "latest-" prefix, e.g., "latest-1.24"; you may use the very latest built CI bits from the kubernetes/kubernetes master branch by passing in "latest". If you provide a `KUBERNETES_VERSION` environment variable, you may not also use `CI_VERSION` (below). Use only one configuration variable to declare the version of Kubernetes to test. |
598+
| `KUBERNETES_VERSION` | Desired Kubernetes version to test. You can pass in a definitive released version, e.g., "v1.24.0". If you want to use pre-released CI bits of a particular release you may use the "latest-" prefix, e.g., "latest-1.24"; you may use the very latest built CI bits from the kubernetes/kubernetes master branch by passing in "latest". For end-of-life Kubernetes versions whose CI artifacts are no longer published, CAPZ sets `KUBERNETES_VERSION` to a static final patch release instead (see `capz::util::get_eol_k8s_version` in `hack/util.sh`). If you provide a `KUBERNETES_VERSION` environment variable, you may not also use `CI_VERSION` (below). Use only one configuration variable to declare the version of Kubernetes to test. |
599599
| `CI_VERSION` | Provide a custom CI version of Kubernetes (e.g., `v1.25.0-alpha.0.597+aa49dffc7f24dc`). If not specified, this will be determined from the KUBERNETES_VERSION above if it is an unreleased version. If you provide a `CI_VERSION` environment variable, you may not also use `KUBERNETES_VERSION` (above). |
600600
| `TEST_CCM` | Build a cluster that uses custom versions of the Azure cloud-provider cloud-controller-manager and node-controller-manager images |
601601
| `EXP_MACHINE_POOL` | Use [Machine Pool](../self-managed/machinepools.md) for worker machines. Defaults to true. |

hack/util.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ set -o pipefail
2020

2121
CURL_RETRIES=3
2222

23+
# capz::util::get_eol_k8s_version returns the final patch release for an EOL Kubernetes version.
24+
capz::util::get_eol_k8s_version() {
25+
case "$1" in
26+
latest-1.30) echo "v1.30.14" ;;
27+
latest-1.31) echo "v1.31.14" ;;
28+
*) return 1 ;;
29+
esac
30+
}
31+
2332
capz::util::get_latest_ci_version() {
2433
release="${1}"
2534
ci_version_url="https://dl.k8s.io/ci/latest-${release}.txt"

scripts/ci-entrypoint.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@ setup() {
7676
fi
7777

7878
if [[ "${KUBERNETES_VERSION:-}" =~ "latest" ]]; then
79-
CI_VERSION_URL="https://dl.k8s.io/ci/${KUBERNETES_VERSION}.txt"
80-
export CI_VERSION="${CI_VERSION:-$(curl --retry 3 -sSL "${CI_VERSION_URL}")}"
79+
EOL_VERSION="$(capz::util::get_eol_k8s_version "${KUBERNETES_VERSION}" || true)"
80+
if [[ -n "${EOL_VERSION}" ]]; then
81+
echo "EOL Kubernetes version detected, using release ${EOL_VERSION}"
82+
export CI_VERSION="${EOL_VERSION}"
83+
else
84+
CI_VERSION_URL="https://dl.k8s.io/ci/${KUBERNETES_VERSION}.txt"
85+
export CI_VERSION="${CI_VERSION:-$(curl --retry 3 -sSL "${CI_VERSION_URL}")}"
86+
fi
8187
fi
8288
if [[ -n "${CI_VERSION:-}" ]]; then
8389
echo "Using CI_VERSION ${CI_VERSION}"

0 commit comments

Comments
 (0)