Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

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

Pranshu Mahajancadfe14abeaa
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" $ }}