Skip to content

Commit f453641

Browse files
authored
feat: adding HPA capabilities check (#364)
* Adding HPA capabilities check Signed-off-by: Ryan Bueter <[email protected]> * Bumping version and adding change Signed-off-by: Ryan Bueter <[email protected]> --------- Signed-off-by: Ryan Bueter <[email protected]>
1 parent 40ea5c5 commit f453641

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

helm/oauth2-proxy/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: oauth2-proxy
2-
version: 8.3.1
2+
version: 8.3.2
33
apiVersion: v2
44
appVersion: 7.12.0
55
home: https://oauth2-proxy.github.io/oauth2-proxy/
@@ -32,7 +32,7 @@ kubeVersion: ">=1.16.0-0"
3232
annotations:
3333
artifacthub.io/changes: |
3434
- kind: added
35-
description: Bump Redis Chart Version
35+
description: Adds backwards compatibility with Kubernetes 1.20 by selecting the HPA apiVersion of autoscaling/v2beta2
3636
links:
3737
- name: Github PR
38-
url: https://github.com/oauth2-proxy/manifests/pull/361
38+
url: https://github.com/oauth2-proxy/manifests/pull/364

helm/oauth2-proxy/templates/_capabilities.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,14 @@ Return the appropriate apiVersion for ingress object.
2121
{{- print "networking.k8s.io/v1" -}}
2222
{{- end -}}
2323
{{- end -}}
24+
25+
{{/*
26+
Return the appropriate apiVersion for HorizontalPodAutoscaler object.
27+
*/}}
28+
{{- define "capabilities.horizontalPodAutoscaler.apiVersion" -}}
29+
{{- if semverCompare "<1.23-0" ( .Values.kubeVersion | default .Capabilities.KubeVersion.Version ) -}}
30+
{{- print "autoscaling/v2beta2" -}}
31+
{{- else -}}
32+
{{- print "autoscaling/v2" -}}
33+
{{- end -}}
34+
{{- end -}}

helm/oauth2-proxy/templates/hpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if .Values.autoscaling.enabled }}
2-
apiVersion: autoscaling/v2
2+
apiVersion: {{ include "capabilities.horizontalPodAutoscaler.apiVersion" . }}
33
kind: HorizontalPodAutoscaler
44
metadata:
55
labels:

0 commit comments

Comments
 (0)