⚙️ fix: Dynamic HPA API Version Selection for K8s Compatibility (#9320)

Co-authored-by: Pranshu Mahajan <pranshu.mahajan#foxtel.com.au>
This commit is contained in:
Pranshu Mahajan 2025-09-06 01:11:51 +10:00 committed by GitHub
parent 75dd6fb28b
commit cadfe14abe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -63,3 +63,16 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }} {{- default "default" .Values.serviceAccount.name }}
{{- end }} {{- end }}
{{- 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 -}}

View file

@ -1,5 +1,5 @@
{{- if .Values.autoscaling.enabled }} {{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1 apiVersion: {{ include "librechat.hpa.apiVersion" $ }}
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
metadata: metadata:
name: {{ include "librechat.fullname" $ }} name: {{ include "librechat.fullname" $ }}