diff --git a/cluster-autoscaler/README.md b/cluster-autoscaler/README.md index 3744fb09b9ec..5096775c7eb6 100644 --- a/cluster-autoscaler/README.md +++ b/cluster-autoscaler/README.md @@ -47,34 +47,34 @@ We recommend using Cluster Autoscaler with the Kubernetes control plane (previou Starting from Kubernetes 1.12, versioning scheme was changed to match Kubernetes minor releases exactly. -| Kubernetes Version | CA Version | -|--------|--------| -| 1.29.X | 1.29.X | -| 1.28.X | 1.28.X | -| 1.27.X | 1.27.X | -| 1.26.X | 1.26.X | -| 1.25.X | 1.25.X | -| 1.24.X | 1.24.X | -| 1.23.X | 1.23.X | -| 1.22.X | 1.22.X | -| 1.21.X | 1.21.X | -| 1.20.X | 1.20.X | -| 1.19.X | 1.19.X | -| 1.18.X | 1.18.X | -| 1.17.X | 1.17.X | -| 1.16.X | 1.16.X | -| 1.15.X | 1.15.X | -| 1.14.X | 1.14.X | -| 1.13.X | 1.13.X | -| 1.12.X | 1.12.X | -| 1.11.X | 1.3.X | -| 1.10.X | 1.2.X | -| 1.9.X | 1.1.X | -| 1.8.X | 1.0.X | -| 1.7.X | 0.6.X | -| 1.6.X | 0.5.X, 0.6.X* | -| 1.5.X | 0.4.X | -| 1.4.X | 0.3.X | +| Kubernetes Version | CA Version | Chart Version | +|--------------------|--------------------------|---------------| +| 1.29.X | 1.29.X |9.35.0+| +| 1.28.X | 1.28.X |9.34.0+| +| 1.27.X | 1.27.X |9.29.0+| +| 1.26.X | 1.26.X |9.28.0+| +| 1.25.X | 1.25.X | | +| 1.24.X | 1.24.X |9.25.0+| +| 1.23.X | 1.23.X |9.14.0+| +| 1.22.X | 1.22.X | | +| 1.21.X | 1.21.X |9.10.0+| +| 1.20.X | 1.20.X |9.5.0+| +| 1.19.X | 1.19.X | | +| 1.18.X | 1.18.X |9.0.0+| +| 1.17.X | 1.17.X | | +| 1.16.X | 1.16.X | | +| 1.15.X | 1.15.X | | +| 1.14.X | 1.14.X | | +| 1.13.X | 1.13.X | | +| 1.12.X | 1.12.X | | +| 1.11.X | 1.3.X | | +| 1.10.X | 1.2.X | | +| 1.9.X | 1.1.X | | +| 1.8.X | 1.0.X | | +| 1.7.X | 0.6.X | | +| 1.6.X | 0.5.X, 0.6.X* | | +| 1.5.X | 0.4.X | | +| 1.4.X | 0.3.X | | *Cluster Autoscaler 0.5.X is the official version shipped with k8s 1.6. We've done some basic tests using k8s 1.6 / CA 0.6 and we're not aware of any problems with this setup. However, Cluster Autoscaler internally simulates Kubernetes' scheduler and using different versions of scheduler code can lead to subtle issues. diff --git a/cluster-autoscaler/hack/update-chart-version-readme.sh b/cluster-autoscaler/hack/update-chart-version-readme.sh new file mode 100755 index 000000000000..51534b1d7ded --- /dev/null +++ b/cluster-autoscaler/hack/update-chart-version-readme.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +# Copyright 2024 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +### +# This script is to be used to update chart compatibility matrix in +# README when there's a new version of the helm chart available +### + +set -eo pipefail + +if [[ -n $(git status -s) ]]; then + echo "Clean git working tree required" + exit 1 +fi + +CA_VERSION=${1:?"usage: update-chart-version-readme.sh (must be a row present in README.md) []"} + +NUM_REVISIONS=${2:-"10"} + +echo "Checking last $NUM_REVISIONS for changes" >&2 +VERSIONS_FILTER="tail -n $NUM_REVISIONS" + +BASE=$(dirname $0) + +REF=$(git branch --show-current | grep . || git rev-parse HEAD) + +function cleanup { + echo 'Going back to $REF' + git checkout "$REF" &>/dev/null + trap - EXIT +} + +trap cleanup EXIT + +# Build version map +VERSIONS=$( + git tag | grep cluster-autoscaler-chart | sort -V | $VERSIONS_FILTER | while read ver; do + echo "Checking chart release: $ver" >&2 + git checkout $ver &>/dev/null + + ( + set -eo pipefail + cat $BASE/../../charts/cluster-autoscaler/Chart.yaml \ + | grep -e version -e appVersion + ) \ + | sed -E -e 's/^([^:]+): (.*)/"\1": "\2"/g' \ + | tr '\n' ',' \ + | sed -E -e 's/(.*),/{\1}/g' + done | jq -s '{"cluster-autoscaler": group_by(.appVersion) | map({version: .[0].appVersion, charts: . | map(.version)})}' + ) + +# Get min version where cluster-autoscaler v$CA_VERSION is used +CA_VERSION=${CA_VERSION%%.X} +MIN_COMPATIBLE_VERSION=$(echo "$VERSIONS" | jq -r --arg ver $CA_VERSION '.["cluster-autoscaler"] | map(select(.version | startswith("\($ver).")) | .charts) | flatten | .[]' | sort -V | head -n1) + +if [[ -z "$MIN_COMPATIBLE_VERSION" ]]; then + echo "No chart versions using cluster-autoscaler v$CA_VERSION detected" >&2 + exit 0 +fi + +echo "Detected min compatible version for cluster-autoscaler v$CA_VERSION" + +cleanup + +# Replace README info with parsed data +awk "!/^\|/ { versions=0 } +/$CA_VERSION/ { if (versions) print(\"\", \$2, \$3, \"$MIN_COMPATIBLE_VERSION+\" \"\", \"\"); else print(\$0) } +!/$CA_VERSION/ { print } +/Kubernetes Version/ { versions=1; FS=\"|\"; OFS=\"|\"; }" $BASE/../README.md > README.md.tmp + +mv README.md.tmp $BASE/../README.md