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