From af0636adfbc66f754f51ad3cfcce9cf8fff4d023 Mon Sep 17 00:00:00 2001 From: mewa Date: Mon, 19 Feb 2024 17:34:01 +0100 Subject: [PATCH 1/8] Format README --- cluster-autoscaler/README.md | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/cluster-autoscaler/README.md b/cluster-autoscaler/README.md index 5992d05b443b..7f962d6907ac 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 | +|--------------------|--------------------------| +| 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 | *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. From 6e6622f51f8d9830721a8120594ff61062d3e18d Mon Sep 17 00:00:00 2001 From: mewa Date: Mon, 19 Feb 2024 17:34:31 +0100 Subject: [PATCH 2/8] Add chart versions --- cluster-autoscaler/README.md | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/cluster-autoscaler/README.md b/cluster-autoscaler/README.md index 7f962d6907ac..c8dac3769847 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 | | +| 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 | | *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. From c4e0e58e436afe238e7b7bff9e93d89d5c4304d5 Mon Sep 17 00:00:00 2001 From: mewa Date: Mon, 19 Feb 2024 18:17:23 +0100 Subject: [PATCH 3/8] Add script to update required chart versions in README --- .../update-chart-version-readme.sh | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 cluster-autoscaler/update-chart-version-readme.sh diff --git a/cluster-autoscaler/update-chart-version-readme.sh b/cluster-autoscaler/update-chart-version-readme.sh new file mode 100755 index 000000000000..535af03cf8e7 --- /dev/null +++ b/cluster-autoscaler/update-chart-version-readme.sh @@ -0,0 +1,59 @@ +#!/bin/bash +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)"} + +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 | 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 From c6f1d2bedc80815b1022f472effa3e3326cdc566 Mon Sep 17 00:00:00 2001 From: mewa Date: Mon, 19 Feb 2024 19:18:29 +0100 Subject: [PATCH 4/8] Add chart version column in version matrix --- cluster-autoscaler/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cluster-autoscaler/README.md b/cluster-autoscaler/README.md index c8dac3769847..8265d5773e79 100644 --- a/cluster-autoscaler/README.md +++ b/cluster-autoscaler/README.md @@ -50,17 +50,17 @@ Starting from Kubernetes 1.12, versioning scheme was changed to match Kubernetes | Kubernetes Version | CA Version | Chart 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.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 | | -| 1.23.X | 1.23.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 | | -| 1.20.X | 1.20.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 | | +| 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 | | From 89595cb8ba26e81c7665ae1f5c8c803fa9348a0d Mon Sep 17 00:00:00 2001 From: mewa Date: Tue, 26 Mar 2024 16:23:03 +0100 Subject: [PATCH 5/8] Move cluster-autoscaler update-chart-version-readme script to /hack --- .../{ => hack}/update-chart-version-readme.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename cluster-autoscaler/{ => hack}/update-chart-version-readme.sh (93%) diff --git a/cluster-autoscaler/update-chart-version-readme.sh b/cluster-autoscaler/hack/update-chart-version-readme.sh similarity index 93% rename from cluster-autoscaler/update-chart-version-readme.sh rename to cluster-autoscaler/hack/update-chart-version-readme.sh index 535af03cf8e7..b1114ac49e69 100755 --- a/cluster-autoscaler/update-chart-version-readme.sh +++ b/cluster-autoscaler/hack/update-chart-version-readme.sh @@ -28,7 +28,7 @@ VERSIONS=$( ( set -eo pipefail - cat $BASE/../charts/cluster-autoscaler/Chart.yaml \ + cat $BASE/../../charts/cluster-autoscaler/Chart.yaml \ | grep -e version -e appVersion ) \ | sed -E -e 's/^([^:]+): (.*)/"\1": "\2"/g' \ @@ -54,6 +54,6 @@ cleanup 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 +/Kubernetes Version/ { versions=1; FS=\"|\"; OFS=\"|\"; }" $BASE/../README.md > README.md.tmp -mv README.md.tmp $BASE/README.md +mv README.md.tmp $BASE/../README.md From 6684448591e44e2f890d40306f139cda2f83ccad Mon Sep 17 00:00:00 2001 From: mewa Date: Tue, 26 Mar 2024 16:35:15 +0100 Subject: [PATCH 6/8] Only check recent revisions when updating README --- cluster-autoscaler/hack/update-chart-version-readme.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cluster-autoscaler/hack/update-chart-version-readme.sh b/cluster-autoscaler/hack/update-chart-version-readme.sh index b1114ac49e69..8c28376a55b5 100755 --- a/cluster-autoscaler/hack/update-chart-version-readme.sh +++ b/cluster-autoscaler/hack/update-chart-version-readme.sh @@ -6,7 +6,12 @@ if [[ -n $(git status -s) ]]; then exit 1 fi -CA_VERSION=${1:?"usage: update-chart-version-readme.sh (must be a row present in README.md)"} +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) @@ -22,7 +27,7 @@ trap cleanup EXIT # Build version map VERSIONS=$( - git tag | grep cluster-autoscaler-chart | sort -V | while read ver; do + 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 From 297295aa444df375156796f0db04b10b18fbdf0d Mon Sep 17 00:00:00 2001 From: mewa Date: Tue, 26 Mar 2024 17:03:55 +0100 Subject: [PATCH 7/8] Update min cluster-autoscaler chart for Kubernetes 1.29 --- cluster-autoscaler/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster-autoscaler/README.md b/cluster-autoscaler/README.md index 8265d5773e79..29e36893d1a4 100644 --- a/cluster-autoscaler/README.md +++ b/cluster-autoscaler/README.md @@ -49,7 +49,7 @@ Starting from Kubernetes 1.12, versioning scheme was changed to match Kubernetes | Kubernetes Version | CA Version | Chart Version | |--------------------|--------------------------|---------------| -| 1.29.X | 1.29.X | | +| 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+| From 3a078ec31794e5442f1e9c1d068591624bd36f76 Mon Sep 17 00:00:00 2001 From: mewa Date: Mon, 8 Apr 2024 14:15:17 +0200 Subject: [PATCH 8/8] Copyright boilerplate --- .../hack/update-chart-version-readme.sh | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cluster-autoscaler/hack/update-chart-version-readme.sh b/cluster-autoscaler/hack/update-chart-version-readme.sh index 8c28376a55b5..51534b1d7ded 100755 --- a/cluster-autoscaler/hack/update-chart-version-readme.sh +++ b/cluster-autoscaler/hack/update-chart-version-readme.sh @@ -1,4 +1,24 @@ -#!/bin/bash +#!/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