diff --git a/helm/oauth2-proxy/Chart.yaml b/helm/oauth2-proxy/Chart.yaml index 1daa0e7..2daa463 100644 --- a/helm/oauth2-proxy/Chart.yaml +++ b/helm/oauth2-proxy/Chart.yaml @@ -1,5 +1,5 @@ name: oauth2-proxy -version: 8.3.1 +version: 8.3.2 apiVersion: v2 appVersion: 7.12.0 home: https://oauth2-proxy.github.io/oauth2-proxy/ @@ -32,7 +32,7 @@ kubeVersion: ">=1.16.0-0" annotations: artifacthub.io/changes: | - kind: added - description: Bump Redis Chart Version + description: Adds backwards compatibility with Kubernetes 1.20 by selecting the HPA apiVersion of autoscaling/v2beta2 links: - name: Github PR - url: https://github.com/oauth2-proxy/manifests/pull/361 + url: https://github.com/oauth2-proxy/manifests/pull/364 diff --git a/helm/oauth2-proxy/templates/_capabilities.tpl b/helm/oauth2-proxy/templates/_capabilities.tpl index f959f10..f441eea 100644 --- a/helm/oauth2-proxy/templates/_capabilities.tpl +++ b/helm/oauth2-proxy/templates/_capabilities.tpl @@ -21,3 +21,14 @@ Return the appropriate apiVersion for ingress object. {{- print "networking.k8s.io/v1" -}} {{- end -}} {{- end -}} + +{{/* +Return the appropriate apiVersion for HorizontalPodAutoscaler object. +*/}} +{{- define "capabilities.horizontalPodAutoscaler.apiVersion" -}} +{{- if semverCompare "<1.23-0" ( .Values.kubeVersion | default .Capabilities.KubeVersion.Version ) -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} diff --git a/helm/oauth2-proxy/templates/hpa.yaml b/helm/oauth2-proxy/templates/hpa.yaml index 7fe67e7..3b7119f 100644 --- a/helm/oauth2-proxy/templates/hpa.yaml +++ b/helm/oauth2-proxy/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2 +apiVersion: {{ include "capabilities.horizontalPodAutoscaler.apiVersion" . }} kind: HorizontalPodAutoscaler metadata: labels: