From 03847114c45f33456095f7c4e7f144145812311b Mon Sep 17 00:00:00 2001 From: felix Date: Mon, 4 Sep 2023 11:06:21 +0000 Subject: [PATCH 1/2] autoscaler api version based on k8s release --- charts/matrix-media-repo/templates/hpa.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/matrix-media-repo/templates/hpa.yaml b/charts/matrix-media-repo/templates/hpa.yaml index 0211744..7d7c85b 100644 --- a/charts/matrix-media-repo/templates/hpa.yaml +++ b/charts/matrix-media-repo/templates/hpa.yaml @@ -1,5 +1,9 @@ {{- if .Values.autoscaling.enabled }} +{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: autoscaling/v2 +{{- else -}} apiVersion: autoscaling/v2beta1 +{{- end }} kind: HorizontalPodAutoscaler metadata: name: {{ include "matrix-media-repo.fullname" . }} From 276eb22c0aef63979e53d13dcdc449de3c78bc1d Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 5 Sep 2023 09:37:31 +0000 Subject: [PATCH 2/2] improved checking for APIversion Capabilities --- charts/matrix-media-repo/templates/hpa.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/matrix-media-repo/templates/hpa.yaml b/charts/matrix-media-repo/templates/hpa.yaml index 7d7c85b..f07019f 100644 --- a/charts/matrix-media-repo/templates/hpa.yaml +++ b/charts/matrix-media-repo/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion -}} +{{- if .Capabilities.APIVersions.Has "autoscaling/v2" -}} apiVersion: autoscaling/v2 {{- else -}} apiVersion: autoscaling/v2beta1