Skip to content

Commit d11f8b2

Browse files
authored
Merge pull request #74 from stackhpc/refactor/ingress-config
Refactor ingress config to allow maximum configurability
2 parents 78b5210 + 1486d98 commit d11f8b2

File tree

5 files changed

+107
-90
lines changed

5 files changed

+107
-90
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: {{ .Release.Name }}-api
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: {{ $.Release.Name }}-api
39+
port:
40+
number: 80
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}

charts/azimuth-llm/templates/test/end-to-end.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ spec:
1717
command:
1818
- python
1919
- gradio-client-test.py
20-
{{- if .Values.ingress.ui.enabled }}
21-
- {{ .Values.ingress.host }}{{ .Values.ingress.ui.path }}
22-
{{- else }}
2320
- http://{{ .Release.Name }}-ui.{{ .Release.Namespace }}.svc
24-
{{- end }}
2521
env:
2622
- name: PYTHONUNBUFFERED
2723
value: "1"

charts/azimuth-llm/templates/test/web-app.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ spec:
1515
command:
1616
- nc
1717
- -vz
18-
{{- if .Values.ingress.ui.enabled }}
19-
- {{ .Values.ingress.host | trimPrefix "http://" | trimPrefix "https://" }}{{ .Values.ingress.ui.path }}
20-
{{- else }}
2118
- {{ .Release.Name }}-ui.{{ .Release.Namespace }}.svc
22-
{{- end }}
2319
- "80"
2420
restartPolicy: Never
2521
backoffLimit: 3
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: {{ .Release.Name }}-ui
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: {{ $.Release.Name }}-ui
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
@@ -51,6 +51,23 @@ api:
5151
iconUrl: https://raw.githubusercontent.com/vllm-project/vllm/v0.2.7/docs/source/assets/logos/vllm-logo-only-light.png
5252
description: |
5353
The OpenAI API for the deployed LLM.
54+
# Standard ingress resource config for backend API
55+
ingress:
56+
enabled: false
57+
className: ""
58+
annotations: {}
59+
# kubernetes.io/ingress.class: nginx
60+
# kubernetes.io/tls-acme: "true"
61+
hosts:
62+
- host: chart-example.local
63+
paths:
64+
- path: /v1
65+
pathType: ImplementationSpecific
66+
tls: []
67+
# - secretName: chart-example-tls
68+
# hosts:
69+
# - chart-example.local
70+
5471
# Config for huggingface model cache volume
5572
# This is mounted at /root/.cache/huggingface in the api deployment
5673
cacheVolume:
@@ -117,38 +134,24 @@ ui:
117134
iconUrl: https://raw.githubusercontent.com/gradio-app/gradio/5524e590577769b0444a5332b8d444aafb0c5c12/js/app/public/static/img/logo.svg
118135
description: |
119136
A web-based user inferface for interacting with the deployed LLM.
137+
# Standard ingress resource config for UI web app
138+
ingress:
139+
enabled: false
140+
className: ""
141+
annotations: {}
142+
# kubernetes.io/ingress.class: nginx
143+
# kubernetes.io/tls-acme: "true"
144+
hosts:
145+
- host: chart-example.local
146+
paths:
147+
- path: /
148+
pathType: ImplementationSpecific
149+
tls: []
150+
# - secretName: chart-example-tls
151+
# hosts:
152+
# - chart-example.local
120153
# The update strategy to use for the deployment
121154
updateStrategy:
122155
rollingUpdate:
123156
maxSurge: 25%
124157
maxUnavailable: 25%
125-
# Settings for configuring ingress resources
126-
# to make the UI and/or backend API accessible
127-
# outside the cluster.
128-
# NOTE: An ingress controller must be installed
129-
# on the target cluster.
130-
ingress:
131-
# The name of the ingress class to use
132-
className: nginx
133-
host:
134-
tls: true
135-
api:
136-
enabled: false
137-
# Defaults to "{{ .Release.name }}"-api
138-
name:
139-
# This is required to be /v1 for an OpenAI API
140-
# unless we add URL rewrite functionality to the
141-
# Ingress resource templates in the future.
142-
path: /v1
143-
# Annotations to apply to the ingress resource
144-
# e.g. for cert-manager integration
145-
annotations:
146-
ui:
147-
enabled: false
148-
# Defaults to "{{ .Release.name }}"-ui
149-
name:
150-
# For a Gradio app this must be the root
151-
path: /
152-
# Annotations to apply to the ingress resource
153-
# e.g. for cert-manager integration
154-
annotations:

0 commit comments

Comments
 (0)