|
| 1 | +--- |
| 2 | +name: update-k8s-ci-versions |
| 3 | +description: > |
| 4 | + Update the Kubernetes versions used by CI to the latest patch releases. |
| 5 | + Checks the current Kubernetes releases at https://kubernetes.io/releases/, |
| 6 | + determines the 4 newest minor lines at their latest patch, and updates the |
| 7 | + GitHub Actions workflows accordingly. Use when asked to "update the |
| 8 | + Kubernetes versions", "bump k8s in CI", or refresh the test matrix. |
| 9 | +--- |
| 10 | + |
| 11 | +# Update Kubernetes CI versions |
| 12 | + |
| 13 | +Keep the Kubernetes versions tested in CI current: the integration-test matrix |
| 14 | +runs the **4 newest minor lines**, each pinned to its **latest patch**, and a |
| 15 | +few single-version references track the **newest** version. |
| 16 | + |
| 17 | +## What to update |
| 18 | + |
| 19 | +There are exactly three Kubernetes-version references in CI. **Do not touch the |
| 20 | +`minikube version:` entries** — those pin the minikube *tool*, not Kubernetes. |
| 21 | + |
| 22 | +| File | Line | What it holds | New value | |
| 23 | +| --- | --- | --- | --- | |
| 24 | +| `.github/workflows/build.yml` | `kubernetes: [ ... ]` matrix | the 4 newest minors at latest patch | `[ 'v1.A.x', 'v1.B.x', 'v1.C.x', 'v1.D.x' ]` (oldest → newest) | |
| 25 | +| `.github/workflows/build.yml` | `kube-version: '...'` (httpclient-tests) | the newest version | the newest of the four | |
| 26 | +| `.github/workflows/e2e-test.yml` | `kubernetes version: '...'` | the newest version | the newest of the four | |
| 27 | + |
| 28 | +If a future grep finds additional real Kubernetes versions, update those too — |
| 29 | +verify with the discovery step below rather than assuming only these three. |
| 30 | + |
| 31 | +## Steps |
| 32 | + |
| 33 | +### 1. Find the current references |
| 34 | + |
| 35 | +```bash |
| 36 | +grep -rn "kubernetes\|kube-version" .github/workflows/build.yml .github/workflows/e2e-test.yml |
| 37 | +``` |
| 38 | + |
| 39 | +Note the existing values so you can report the diff. The newest minor among them |
| 40 | +tells you where the matrix currently ends. |
| 41 | + |
| 42 | +### 2. Determine the latest versions |
| 43 | + |
| 44 | +The source of truth is <https://kubernetes.io/releases/>. Fetch it and read off |
| 45 | +the latest stable version and the supported minor lines: |
| 46 | + |
| 47 | +``` |
| 48 | +WebFetch https://kubernetes.io/releases/ |
| 49 | + → "List the latest stable Kubernetes version and every supported minor |
| 50 | + release with its latest patch version. Give exact x.y.z numbers." |
| 51 | +``` |
| 52 | + |
| 53 | +From the newest minor `1.N`, the four lines you need are `1.N`, `1.N-1`, |
| 54 | +`1.N-2`, `1.N-3`. |
| 55 | + |
| 56 | +`kubernetes.io/releases` only lists *supported* minors (usually the newest |
| 57 | +three), so the oldest of the four (`1.N-3`) is often end-of-life and missing |
| 58 | +there. **Get the latest patch for each of the four minors** from a per-minor |
| 59 | +source that includes EOL lines. Prefer git tags, which need no API token and no |
| 60 | +auth: |
| 61 | + |
| 62 | +```bash |
| 63 | +# Latest stable (non-prerelease) patch for a given minor, e.g. 1.32: |
| 64 | +git ls-remote --tags --refs https://github.com/kubernetes/kubernetes.git 'v1.32.*' \ |
| 65 | + | awk -F/ '{print $NF}' \ |
| 66 | + | grep -E '^v1\.32\.[0-9]+$' \ |
| 67 | + | sort -V | tail -1 |
| 68 | +``` |
| 69 | + |
| 70 | +Run that for each of the four minor numbers. If `git ls-remote` is unavailable, |
| 71 | +fall back to `https://dl.k8s.io/release/stable-1.<minor>.txt` (one request per |
| 72 | +minor) or `gh api repos/kubernetes/kubernetes/releases`. |
| 73 | + |
| 74 | +Cross-check the newest version against what `kubernetes.io/releases` reported as |
| 75 | +latest stable — they should agree. |
| 76 | + |
| 77 | +### 3. Apply the updates |
| 78 | + |
| 79 | +Edit the three references from the table. Keep the exact surrounding format — |
| 80 | +the `v` prefix, single quotes, and matrix ordering (oldest → newest). Example |
| 81 | +if the latest stable is `1.36` and patches are `1.33.14 / 1.34.10 / 1.35.4 / 1.36.1`: |
| 82 | + |
| 83 | +```yaml |
| 84 | +# build.yml matrix |
| 85 | +kubernetes: [ 'v1.33.14', 'v1.34.10', 'v1.35.4', 'v1.36.1' ] |
| 86 | + |
| 87 | +# build.yml httpclient-tests |
| 88 | +kube-version: 'v1.36.1' |
| 89 | + |
| 90 | +# e2e-test.yml |
| 91 | +kubernetes version: 'v1.36.1' |
| 92 | +``` |
| 93 | +
|
| 94 | +If every resolved version already matches what is in the files, report "already |
| 95 | +up to date" and make no changes. |
| 96 | +
|
| 97 | +### 4. Verify and report |
| 98 | +
|
| 99 | +```bash |
| 100 | +grep -rn "v1\.[0-9]\+\.[0-9]\+" .github/workflows/build.yml .github/workflows/e2e-test.yml \ |
| 101 | + | grep -v "minikube version" |
| 102 | +``` |
| 103 | + |
| 104 | +Confirm all three references hold the new values and the minikube versions are |
| 105 | +untouched. Show the user a before/after summary of each changed line. |
| 106 | + |
| 107 | +### 5. (Optional) Open a PR |
| 108 | + |
| 109 | +Only if the user asks. Branch from `main`, commit the workflow changes with a |
| 110 | +message like `chore(ci): bump Kubernetes test versions to latest patches`, push, |
| 111 | +and open a PR with `gh`. Otherwise leave the edits in the working tree. |
0 commit comments