Skip to content

Commit df8e414

Browse files
committed
Refactor ingress config to allow maximum configurability
1 parent f40288e commit df8e414

File tree

3 files changed

+107
-82
lines changed

3 files changed

+107
-82
lines changed
Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1-
{{- if and .Values.api.enabled .Values.ingress.api.enabled -}}
1+
{{- if and .Values.api.enabled .Values.api.ingress.enabled -}}
22
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:
5-
{{ if .Values.ingress.ui.annotations -}}
5+
name: {{ printf "%s-api" .Release.Name }}
6+
labels:
7+
{{- include "azimuth-llm.labels" . | nindent 4 }}
8+
{{- with .Values.api.ingress.annotations }}
69
annotations:
7-
{{- .Values.ingress.api.annotations | toYaml | nindent 4 }}
8-
{{ end -}}
9-
name: {{ default (printf "%s-api" .Release.Name) .Values.ingress.api.name }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
1012
spec:
11-
ingressClassName: {{ .Values.ingress.className }}
12-
rules:
13-
- http:
14-
paths:
15-
- path: {{ .Values.ingress.api.path }}
16-
pathType: Prefix
17-
backend:
18-
service:
19-
name: {{ .Values.api.service.name }}
20-
port:
21-
# Must match Service resource
22-
number: 80
23-
{{ if .Values.ingress.host -}}
24-
host: {{ .Values.ingress.host | quote }}
25-
{{- end -}}
26-
{{- if .Values.ingress.tls }}
13+
{{- with .Values.api.ingress.className }}
14+
ingressClassName: {{ . }}
15+
{{- end }}
16+
{{- if .Values.api.ingress.tls }}
2717
tls:
28-
- hosts:
29-
- {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }}
30-
secretName: {{ .Release.Name }}-api-tls
31-
{{- end -}}
32-
{{- end -}}
18+
{{- range .Values.api.ingress.tls }}
19+
- hosts:
20+
{{- range .hosts }}
21+
- {{ . | quote }}
22+
{{- end }}
23+
secretName: {{ .secretName }}
24+
{{- end }}
25+
{{- end }}
26+
rules:
27+
{{- range .Values.api.ingress.hosts }}
28+
- host: {{ .host | quote }}
29+
http:
30+
paths:
31+
{{- range .paths }}
32+
- path: {{ .path }}
33+
{{- with .pathType }}
34+
pathType: {{ . }}
35+
{{- end }}
36+
backend:
37+
service:
38+
name: {{ include "azimuth-llm.fullname" $ }}
39+
port:
40+
number: 80
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}
Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1-
{{- if and .Values.ui.enabled .Values.ingress.ui.enabled -}}
1+
{{- if and .Values.ui.enabled .Values.ui.ingress.enabled -}}
22
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:
5-
{{ if .Values.ingress.ui.annotations -}}
5+
name: {{ printf "%s-ui" .Release.Name }}
6+
labels:
7+
{{- include "azimuth-llm.labels" . | nindent 4 }}
8+
{{- with .Values.ui.ingress.annotations }}
69
annotations:
7-
{{- .Values.ingress.ui.annotations | toYaml | nindent 4 }}
8-
{{ end -}}
9-
name: {{ default (printf "%s-ui" .Release.Name) .Values.ingress.ui.name }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
1012
spec:
11-
ingressClassName: {{ .Values.ingress.className }}
12-
rules:
13-
- http:
14-
paths:
15-
- path: {{ .Values.ingress.ui.path }}
16-
pathType: Prefix
17-
backend:
18-
service:
19-
name: {{ .Values.ui.service.name }}
20-
port:
21-
# Must match Service resource
22-
number: 80
23-
{{ if .Values.ingress.host -}}
24-
host: {{ .Values.ingress.host | quote }}
25-
{{- end -}}
26-
{{- if .Values.ingress.tls }}
13+
{{- with .Values.ui.ingress.className }}
14+
ingressClassName: {{ . }}
15+
{{- end }}
16+
{{- if .Values.ui.ingress.tls }}
2717
tls:
28-
- hosts:
29-
- {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }}
30-
secretName: {{ .Release.Name }}-ui-tls
31-
{{- end -}}
32-
{{- end -}}
18+
{{- range .Values.ui.ingress.tls }}
19+
- hosts:
20+
{{- range .hosts }}
21+
- {{ . | quote }}
22+
{{- end }}
23+
secretName: {{ .secretName }}
24+
{{- end }}
25+
{{- end }}
26+
rules:
27+
{{- range .Values.ui.ingress.hosts }}
28+
- host: {{ .host | quote }}
29+
http:
30+
paths:
31+
{{- range .paths }}
32+
- path: {{ .path }}
33+
{{- with .pathType }}
34+
pathType: {{ . }}
35+
{{- end }}
36+
backend:
37+
service:
38+
name: {{ include "azimuth-llm.fullname" $ }}
39+
port:
40+
number: 80
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}

charts/azimuth-llm/values.yaml

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ api:
5050
iconUrl: https://raw.githubusercontent.com/vllm-project/vllm/v0.2.7/docs/source/assets/logos/vllm-logo-only-light.png
5151
description: |
5252
The OpenAI API for the deployed LLM.
53+
# Standard ingress resource config for backend API
54+
ingress:
55+
enabled: false
56+
className: ""
57+
annotations: {}
58+
# kubernetes.io/ingress.class: nginx
59+
# kubernetes.io/tls-acme: "true"
60+
hosts:
61+
- host: chart-example.local
62+
paths:
63+
- path: /v1
64+
pathType: ImplementationSpecific
65+
tls: []
66+
# - secretName: chart-example-tls
67+
# hosts:
68+
# - chart-example.local
69+
5370
# Config for huggingface model cache volume
5471
# This is mounted at /root/.cache/huggingface in the api deployment
5572
cacheVolume:
@@ -114,38 +131,24 @@ ui:
114131
iconUrl: https://raw.githubusercontent.com/gradio-app/gradio/5524e590577769b0444a5332b8d444aafb0c5c12/js/app/public/static/img/logo.svg
115132
description: |
116133
A web-based user inferface for interacting with the deployed LLM.
134+
# Standard ingress resource config for UI web app
135+
ingress:
136+
enabled: false
137+
className: ""
138+
annotations: {}
139+
# kubernetes.io/ingress.class: nginx
140+
# kubernetes.io/tls-acme: "true"
141+
hosts:
142+
- host: chart-example.local
143+
paths:
144+
- path: /
145+
pathType: ImplementationSpecific
146+
tls: []
147+
# - secretName: chart-example-tls
148+
# hosts:
149+
# - chart-example.local
117150
# The update strategy to use for the deployment
118151
updateStrategy:
119152
rollingUpdate:
120153
maxSurge: 25%
121154
maxUnavailable: 25%
122-
# Settings for configuring ingress resources
123-
# to make the UI and/or backend API accessible
124-
# outside the cluster.
125-
# NOTE: An ingress controller must be installed
126-
# on the target cluster.
127-
ingress:
128-
# The name of the ingress class to use
129-
className: nginx
130-
host:
131-
tls: true
132-
api:
133-
enabled: false
134-
# Defaults to "{{ .Release.name }}"-api
135-
name:
136-
# This is required to be /v1 for an OpenAI API
137-
# unless we add URL rewrite functionality to the
138-
# Ingress resource templates in the future.
139-
path: /v1
140-
# Annotations to apply to the ingress resource
141-
# e.g. for cert-manager integration
142-
annotations:
143-
ui:
144-
enabled: false
145-
# Defaults to "{{ .Release.name }}"-ui
146-
name:
147-
# For a Gradio app this must be the root
148-
path: /
149-
# Annotations to apply to the ingress resource
150-
# e.g. for cert-manager integration
151-
annotations:

0 commit comments

Comments
 (0)