diff --git a/helm/librechat/templates/_helpers.tpl b/helm/librechat/templates/_helpers.tpl index 6d0476e894..4c242d9582 100755 --- a/helm/librechat/templates/_helpers.tpl +++ b/helm/librechat/templates/_helpers.tpl @@ -63,3 +63,16 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Define apiVersion of HorizontalPodAutoscaler +*/}} +{{- define "librechat.hpa.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "autoscaling/v2" -}} +{{- print "autoscaling/v2" -}} +{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta2" -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- end -}} diff --git a/helm/librechat/templates/hpa.yaml b/helm/librechat/templates/hpa.yaml index b01936cdcf..aa990fb668 100755 --- a/helm/librechat/templates/hpa.yaml +++ b/helm/librechat/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 +apiVersion: {{ include "librechat.hpa.apiVersion" $ }} kind: HorizontalPodAutoscaler metadata: name: {{ include "librechat.fullname" $ }}