diff --git a/stable/cluster-autoscaler/Chart.yaml b/stable/cluster-autoscaler/Chart.yaml index 81a799e401..7e95b935a1 100644 --- a/stable/cluster-autoscaler/Chart.yaml +++ b/stable/cluster-autoscaler/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: Scales worker nodes within autoscaling groups. icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png name: cluster-autoscaler -version: 5.1.1 +version: 6.0.0 appVersion: 1.14.5 home: https://github.com/kubernetes/autoscaler sources: diff --git a/stable/cluster-autoscaler/README.md b/stable/cluster-autoscaler/README.md index b436981a93..6eb336f5a3 100644 --- a/stable/cluster-autoscaler/README.md +++ b/stable/cluster-autoscaler/README.md @@ -164,7 +164,6 @@ Parameter | Description | Default `extraEnvSecrets` | additional container environment variables from a secret | `{}` `nodeSelector` | node labels for pod assignment | `{}` `podAnnotations` | annotations to add to each pod | `{}` -`deployment.apiVersion` | apiVersion for the deployment | `extensions/v1beta1` `rbac.create` | If true, create & use RBAC resources | `false` `rbac.serviceAccountName` | existing ServiceAccount to use (ignored if rbac.create=true) | `default` `rbac.serviceAccountAnnotations` | Additional Service Account annotations | `{}` diff --git a/stable/cluster-autoscaler/templates/_helpers.tpl b/stable/cluster-autoscaler/templates/_helpers.tpl index 3a91e9b48f..adce604e4f 100644 --- a/stable/cluster-autoscaler/templates/_helpers.tpl +++ b/stable/cluster-autoscaler/templates/_helpers.tpl @@ -43,3 +43,25 @@ Return labels, including instance and name. app.kubernetes.io/managed-by: {{ .Release.Service | quote }} helm.sh/chart: {{ include "cluster-autoscaler.chart" . | quote }} {{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "deployment.apiVersion" -}} +{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "apps/v1beta2" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for podsecuritypolicy. +*/}} +{{- define "podsecuritypolicy.apiVersion" -}} +{{- if semverCompare "<1.10-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "policy/v1beta1" -}} +{{- end -}} +{{- end -}} diff --git a/stable/cluster-autoscaler/templates/deployment.yaml b/stable/cluster-autoscaler/templates/deployment.yaml index 625a9d35bc..2eb5cc813e 100644 --- a/stable/cluster-autoscaler/templates/deployment.yaml +++ b/stable/cluster-autoscaler/templates/deployment.yaml @@ -1,6 +1,6 @@ {{- if or .Values.autoDiscovery.clusterName .Values.autoscalingGroups }} {{/* one of the above is required */}} -apiVersion: {{ .Values.deployment.apiVersion }} +apiVersion: {{ template "deployment.apiVersion" . }} kind: Deployment metadata: labels: diff --git a/stable/cluster-autoscaler/templates/podsecuritypolicy.yaml b/stable/cluster-autoscaler/templates/podsecuritypolicy.yaml index a2a0b826f9..9b4480fb30 100644 --- a/stable/cluster-autoscaler/templates/podsecuritypolicy.yaml +++ b/stable/cluster-autoscaler/templates/podsecuritypolicy.yaml @@ -1,5 +1,5 @@ {{- if .Values.rbac.pspEnabled }} -apiVersion: extensions/v1beta1 +apiVersion: {{ template "podsecuritypolicy.apiVersion" . }} kind: PodSecurityPolicy metadata: name: {{ template "cluster-autoscaler.fullname" . }} diff --git a/stable/cluster-autoscaler/values.yaml b/stable/cluster-autoscaler/values.yaml index 788d3439e5..0e4d62f1c5 100644 --- a/stable/cluster-autoscaler/values.yaml +++ b/stable/cluster-autoscaler/values.yaml @@ -104,9 +104,6 @@ podAnnotations: {} podLabels: {} replicaCount: 1 -deployment: - apiVersion: "extensions/v1beta1" - rbac: ## If true, create & use RBAC resources ##