diff --git a/templates/envoy/ai-gateway-route.yaml b/templates/envoy/ai-gateway-route.yaml index c0c67d1..c019653 100644 --- a/templates/envoy/ai-gateway-route.yaml +++ b/templates/envoy/ai-gateway-route.yaml @@ -31,4 +31,19 @@ spec: - name: {{ include "model.fullname" (merge (dict "modelName" $name) $) }} {{- end }} {{- end }} + {{- /* The backend serves the target under its fullName, so the gateway rewrites the alias. */}} + {{- range $alias, $target := .Values.modelAliases }} + {{- $model := index $.Values.models $target | default dict }} + {{- if not (or $model.internal $model.apiUrl) }} + {{- fail (printf "modelAliases.%s: %q is not a routed model in .Values.models" $alias $target) }} + {{- end }} + - matches: + - headers: + - type: Exact + name: x-ai-eg-model + value: {{ $alias }} + backendRefs: + - name: {{ include "model.fullname" (merge (dict "modelName" $target) $) }} + modelNameOverride: {{ $model.fullName }} + {{- end }} {{- end }} diff --git a/templates/init_job/init_secret.yaml b/templates/init_job/init_secret.yaml index ebfc551..4d661bf 100644 --- a/templates/init_job/init_secret.yaml +++ b/templates/init_job/init_secret.yaml @@ -10,6 +10,6 @@ stringData: host = "{{ include "openwebui.fullname" . }}.{{ $.Release.Namespace }}.svc.cluster.local:8080" admin_user = "{{ .Values.openwebui.admin.user | required ".Values.openwebui.admin.user is required" }}" admin_email = "{{ .Values.openwebui.admin.email | required ".Values.openwebui.admin.email is required"}}" - model_ids = [{{ range $name, $model := .Values.models }}"{{ $model.fullName }}",{{ end }}] + model_ids = [{{ range $name, $model := .Values.models }}"{{ $model.fullName }}",{{ end }}{{ range $alias, $_ := .Values.modelAliases }}"{{ $alias }}",{{ end }}] OPENWEBUI_ADMIN_PASSWORD: {{ .Values.openwebui.admin.password | required ".Values.openwebui.admin.password" | quote }} {{- end }} diff --git a/tools/helm/lint-values.yaml b/tools/helm/lint-values.yaml index cd22008..85e9266 100644 --- a/tools/helm/lint-values.yaml +++ b/tools/helm/lint-values.yaml @@ -30,3 +30,5 @@ models: <<: *model persistence: { enabled: false } cacheDir: { claimName: pvc-example-home } +modelAliases: + lint-alias: lint diff --git a/values.yaml b/values.yaml index cfb461d..bc2a251 100644 --- a/values.yaml +++ b/values.yaml @@ -83,6 +83,10 @@ openwebui: models: {} +# Stable model names: alias -> key of `models` (not its fullName). +modelAliases: {} + # sdsc-large: model-short-name + initJob: image: repository: ghcr.io/swissdatasciencecenter/llm-serving/init