From 9e85c3200afe46a77763e81f993231c88d0a9d20 Mon Sep 17 00:00:00 2001 From: Ryan Bueter Date: Thu, 30 Oct 2025 12:23:57 -0600 Subject: [PATCH 1/2] Adding HPA capabilities check Signed-off-by: Ryan Bueter --- helm/oauth2-proxy/templates/_capabilities.tpl | 11 +++++++++++ helm/oauth2-proxy/templates/hpa.yaml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/helm/oauth2-proxy/templates/_capabilities.tpl b/helm/oauth2-proxy/templates/_capabilities.tpl index f959f10e..f441eeaf 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 7fe67e7b..3b7119fc 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: From 5f4b3b6252c01a9bb3da7edfac00070827d9c457 Mon Sep 17 00:00:00 2001 From: Ryan Bueter Date: Thu, 30 Oct 2025 13:11:29 -0600 Subject: [PATCH 2/2] Bumping version and adding change Signed-off-by: Ryan Bueter --- helm/oauth2-proxy/Chart.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm/oauth2-proxy/Chart.yaml b/helm/oauth2-proxy/Chart.yaml index 1daa0e70..2daa463f 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