Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Update HPA to new api autoscaling v2 (#58)
Browse files Browse the repository at this point in the history
* Update hpa to new api autoscaling v2

Update hpa to new api autoscaling v2

Signed-off-by: AB <[email protected]>

* add backward compatibility

Signed-off-by: AB <[email protected]>

---------

Signed-off-by: AB <[email protected]>
  • Loading branch information
bhataprameya authored Dec 7, 2023
1 parent a19d95d commit 256102a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Return the appropriate apiVersion for HPA autoscaling APIs.
*/}}
{{- define "autoscaling.apiVersion" -}}
{{- if or (.Capabilities.APIVersions.Has "autoscaling/v2/HorizontalPodAutoscaler") (semverCompare ">=1.23" .Capabilities.KubeVersion.Version) -}}
autoscaling/v2
{{- else -}}
autoscaling/v2beta2
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ template "autoscaling.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "benthos.fullname" . }}
Expand Down

0 comments on commit 256102a

Please sign in to comment.