diff --git a/charts/cluster-autoscaler/Chart.yaml b/charts/cluster-autoscaler/Chart.yaml index acf5456d6d..30a7a13db6 100644 --- a/charts/cluster-autoscaler/Chart.yaml +++ b/charts/cluster-autoscaler/Chart.yaml @@ -17,4 +17,4 @@ name: cluster-autoscaler sources: - https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler type: application -version: 9.18.0 +version: 9.18.1 diff --git a/charts/cluster-autoscaler/templates/_helpers.tpl b/charts/cluster-autoscaler/templates/_helpers.tpl index 726086e899..944fd1cf6f 100644 --- a/charts/cluster-autoscaler/templates/_helpers.tpl +++ b/charts/cluster-autoscaler/templates/_helpers.tpl @@ -75,6 +75,18 @@ Return the appropriate apiVersion for podsecuritypolicy. {{- end -}} {{- end -}} +{{/* +Return the appropriate apiVersion for podDisruptionBudget. +*/}} +{{- define "podDisruptionBudget.apiVersion" -}} +{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} +{{- if semverCompare "<1.21-0" $kubeTargetVersion -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + {{/* Return the service account name used by the pod. */}} diff --git a/charts/cluster-autoscaler/templates/pdb.yaml b/charts/cluster-autoscaler/templates/pdb.yaml index 19a7d01c1e..8ad782096b 100644 --- a/charts/cluster-autoscaler/templates/pdb.yaml +++ b/charts/cluster-autoscaler/templates/pdb.yaml @@ -1,5 +1,5 @@ {{- if .Values.podDisruptionBudget -}} -apiVersion: policy/v1beta1 +apiVersion: {{ template "podDisruptionBudget.apiVersion" . }} kind: PodDisruptionBudget metadata: labels: