diff --git a/charts/azimuth-llm/templates/api/ingress.yml b/charts/azimuth-llm/templates/api/ingress.yml index d0ba22c..af3cbdc 100644 --- a/charts/azimuth-llm/templates/api/ingress.yml +++ b/charts/azimuth-llm/templates/api/ingress.yml @@ -1,32 +1,43 @@ -{{- if and .Values.api.enabled .Values.ingress.api.enabled -}} +{{- if and .Values.api.enabled .Values.api.ingress.enabled -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - {{ if .Values.ingress.ui.annotations -}} + name: {{ printf "%s-api" .Release.Name }} + labels: + {{- include "azimuth-llm.labels" . | nindent 4 }} + {{- with .Values.api.ingress.annotations }} annotations: - {{- .Values.ingress.api.annotations | toYaml | nindent 4 }} - {{ end -}} - name: {{ default (printf "%s-api" .Release.Name) .Values.ingress.api.name }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: - ingressClassName: {{ .Values.ingress.className }} - rules: - - http: - paths: - - path: {{ .Values.ingress.api.path }} - pathType: Prefix - backend: - service: - name: {{ .Release.Name }}-api - port: - # Must match Service resource - number: 80 - {{ if .Values.ingress.host -}} - host: {{ .Values.ingress.host | quote }} - {{- end -}} - {{- if .Values.ingress.tls }} + {{- with .Values.api.ingress.className }} + ingressClassName: {{ . }} + {{- end }} + {{- if .Values.api.ingress.tls }} tls: - - hosts: - - {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }} - secretName: {{ .Release.Name }}-api-tls - {{- end -}} -{{- end -}} + {{- range .Values.api.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.api.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- with .pathType }} + pathType: {{ . }} + {{- end }} + backend: + service: + name: {{ $.Release.Name }}-api + port: + number: 80 + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/azimuth-llm/templates/test/end-to-end.yml b/charts/azimuth-llm/templates/test/end-to-end.yml index 6aecf38..ff3f85c 100644 --- a/charts/azimuth-llm/templates/test/end-to-end.yml +++ b/charts/azimuth-llm/templates/test/end-to-end.yml @@ -17,11 +17,7 @@ spec: command: - python - gradio-client-test.py - {{- if .Values.ingress.ui.enabled }} - - {{ .Values.ingress.host }}{{ .Values.ingress.ui.path }} - {{- else }} - http://{{ .Release.Name }}-ui.{{ .Release.Namespace }}.svc - {{- end }} env: - name: PYTHONUNBUFFERED value: "1" diff --git a/charts/azimuth-llm/templates/test/web-app.yml b/charts/azimuth-llm/templates/test/web-app.yml index 3193fb3..213e386 100644 --- a/charts/azimuth-llm/templates/test/web-app.yml +++ b/charts/azimuth-llm/templates/test/web-app.yml @@ -15,11 +15,7 @@ spec: command: - nc - -vz - {{- if .Values.ingress.ui.enabled }} - - {{ .Values.ingress.host | trimPrefix "http://" | trimPrefix "https://" }}{{ .Values.ingress.ui.path }} - {{- else }} - {{ .Release.Name }}-ui.{{ .Release.Namespace }}.svc - {{- end }} - "80" restartPolicy: Never backoffLimit: 3 diff --git a/charts/azimuth-llm/templates/ui/ingress.yml b/charts/azimuth-llm/templates/ui/ingress.yml index c2cc8be..8565522 100644 --- a/charts/azimuth-llm/templates/ui/ingress.yml +++ b/charts/azimuth-llm/templates/ui/ingress.yml @@ -1,32 +1,43 @@ -{{- if and .Values.ui.enabled .Values.ingress.ui.enabled -}} +{{- if and .Values.ui.enabled .Values.ui.ingress.enabled -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - {{ if .Values.ingress.ui.annotations -}} + name: {{ printf "%s-ui" .Release.Name }} + labels: + {{- include "azimuth-llm.labels" . | nindent 4 }} + {{- with .Values.ui.ingress.annotations }} annotations: - {{- .Values.ingress.ui.annotations | toYaml | nindent 4 }} - {{ end -}} - name: {{ default (printf "%s-ui" .Release.Name) .Values.ingress.ui.name }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: - ingressClassName: {{ .Values.ingress.className }} - rules: - - http: - paths: - - path: {{ .Values.ingress.ui.path }} - pathType: Prefix - backend: - service: - name: {{ .Release.Name }}-ui - port: - # Must match Service resource - number: 80 - {{ if .Values.ingress.host -}} - host: {{ .Values.ingress.host | quote }} - {{- end -}} - {{- if .Values.ingress.tls }} + {{- with .Values.ui.ingress.className }} + ingressClassName: {{ . }} + {{- end }} + {{- if .Values.ui.ingress.tls }} tls: - - hosts: - - {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }} - secretName: {{ .Release.Name }}-ui-tls - {{- end -}} -{{- end -}} + {{- range .Values.ui.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ui.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- with .pathType }} + pathType: {{ . }} + {{- end }} + backend: + service: + name: {{ $.Release.Name }}-ui + port: + number: 80 + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/azimuth-llm/values.yaml b/charts/azimuth-llm/values.yaml index 9a02aca..7d037f0 100644 --- a/charts/azimuth-llm/values.yaml +++ b/charts/azimuth-llm/values.yaml @@ -51,6 +51,23 @@ api: iconUrl: https://raw.githubusercontent.com/vllm-project/vllm/v0.2.7/docs/source/assets/logos/vllm-logo-only-light.png description: | The OpenAI API for the deployed LLM. + # Standard ingress resource config for backend API + ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: /v1 + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + # Config for huggingface model cache volume # This is mounted at /root/.cache/huggingface in the api deployment cacheVolume: @@ -117,38 +134,24 @@ ui: iconUrl: https://raw.githubusercontent.com/gradio-app/gradio/5524e590577769b0444a5332b8d444aafb0c5c12/js/app/public/static/img/logo.svg description: | A web-based user inferface for interacting with the deployed LLM. + # Standard ingress resource config for UI web app + ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local # The update strategy to use for the deployment updateStrategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% -# Settings for configuring ingress resources -# to make the UI and/or backend API accessible -# outside the cluster. -# NOTE: An ingress controller must be installed -# on the target cluster. -ingress: - # The name of the ingress class to use - className: nginx - host: - tls: true - api: - enabled: false - # Defaults to "{{ .Release.name }}"-api - name: - # This is required to be /v1 for an OpenAI API - # unless we add URL rewrite functionality to the - # Ingress resource templates in the future. - path: /v1 - # Annotations to apply to the ingress resource - # e.g. for cert-manager integration - annotations: - ui: - enabled: false - # Defaults to "{{ .Release.name }}"-ui - name: - # For a Gradio app this must be the root - path: / - # Annotations to apply to the ingress resource - # e.g. for cert-manager integration - annotations: