From 721e5cd9c5d8a1cc018782919b29f51767993ad8 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Mon, 12 Oct 2026 23:03:15 +0300 Subject: [PATCH] fix(kubernetes): keep cluster-autoscaler on the v1beta1 Cluster API The tenant cluster-autoscaler reads the newest Cluster API version the management cluster serves unless CAPI_VERSION names one. With Cluster API v1.13 that is v1beta2, and the 1.32 build shipped here predates the autoscaler fixes for reading v1beta2: scale from zero (kubernetes/autoscaler#8410, in 1.34) and infrastructure reference lookup (kubernetes/autoscaler#9458, in 1.36). The pools here carry capacity annotations for scale from zero, so that path is in use. Pinning v1beta1 keeps the autoscaler on the API it was built against. Cluster API serves v1beta1 until v1.16, which leaves time to move the image to a release with both fixes and drop the pin. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin --- .../templates/cluster-autoscaler/deployment.yaml | 9 +++++++++ .../tests/cluster_autoscaler_args_test.yaml | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml b/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml index 81cc78619..f2cb85c66 100644 --- a/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml +++ b/packages/apps/kubernetes/templates/cluster-autoscaler/deployment.yaml @@ -46,6 +46,15 @@ spec: requests: cpu: 125m memory: 128Mi + {{- /* Without CAPI_VERSION the autoscaler reads the newest Cluster API + version the management cluster serves, which is v1beta2 from + Cluster API v1.11. The 1.32 build lacks the fixes for reading + v1beta2 (kubernetes/autoscaler#8410 for scale from zero, #9458 + for infrastructure references), so it stays on v1beta1, served + until Cluster API v1.16, until the image moves past them. */}} + env: + - name: CAPI_VERSION + value: v1beta1 command: - /cluster-autoscaler args: diff --git a/packages/apps/kubernetes/tests/cluster_autoscaler_args_test.yaml b/packages/apps/kubernetes/tests/cluster_autoscaler_args_test.yaml index 44c8ff80f..5edd40b24 100644 --- a/packages/apps/kubernetes/tests/cluster_autoscaler_args_test.yaml +++ b/packages/apps/kubernetes/tests/cluster_autoscaler_args_test.yaml @@ -36,3 +36,14 @@ tests: - notContains: path: spec.template.spec.containers[0].args content: --force-delete-unregistered-nodes=true + + - it: pins the Cluster API version the autoscaler reads to v1beta1 + documentSelector: + path: kind + value: Deployment + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: CAPI_VERSION + value: v1beta1