Skip to content

Commit 04abbcb

Browse files
authored
Merge pull request #29 from stackhpc/feat/backend-ingress
Add backend ingress functionality
2 parents 57a9dfd + 84c79f5 commit 04abbcb

File tree

5 files changed

+96
-44
lines changed

5 files changed

+96
-44
lines changed

chart/templates/api/ingress.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.ingress.api.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
{{ if .Values.ingress.ui.annotations -}}
6+
annotations:
7+
{{- .Values.ingress.api.annotations | toYaml | nindent 4 }}
8+
{{ end -}}
9+
name: {{ default (printf "%s-api" .Release.Name) .Values.ingress.api.name }}
10+
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 }}
27+
tls:
28+
- hosts:
29+
- {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }}
30+
secretName: {{ .Release.Name }}-tls
31+
{{- end -}}
32+
{{- end -}}

chart/templates/api/service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ spec:
1212
targetPort: api
1313
type: {{ .Values.api.service.type }}
1414
selector:
15-
{{- include "azimuth-llm.api-selectorLabels" . | nindent 4 }}
15+
{{- include "azimuth-llm.api-selectorLabels" . | nindent 4 }}

chart/templates/ui/ingress.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if and .Values.ui.enabled .Values.ingress.ui.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
{{ if .Values.ingress.ui.annotations -}}
6+
annotations:
7+
{{- .Values.ingress.ui.annotations | toYaml | nindent 4 }}
8+
{{ end -}}
9+
name: {{ default (printf "%s-ui" .Release.Name) .Values.ingress.ui.name }}
10+
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 }}
27+
tls:
28+
- hosts:
29+
- {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }}
30+
secretName: {{ .Release.Name }}-tls
31+
{{- end -}}
32+
{{- end -}}

chart/templates/ui/service.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{{- if .Values.ui.enabled -}}
2-
---
32
apiVersion: v1
43
kind: Service
54
metadata:
@@ -15,30 +14,4 @@ spec:
1514
type: {{ .Values.ui.service.type }}
1615
selector:
1716
{{- include "azimuth-llm.ui-selectorLabels" . | nindent 4 }}
18-
---
19-
{{- if .Values.ui.ingress.host -}}
20-
apiVersion: networking.k8s.io/v1
21-
kind: Ingress
22-
metadata:
23-
annotations:
24-
{{- .Values.ui.ingress.annotations | toYaml | nindent 4 }}
25-
name: {{ .Values.ui.ingress.name | default .Release.Name }}
26-
spec:
27-
ingressClassName: nginx
28-
rules:
29-
- host: {{ .Values.ui.ingress.host | quote }}
30-
http:
31-
paths:
32-
- backend:
33-
service:
34-
name: {{ .Values.ui.service.name }}
35-
port:
36-
number: 80 # Must match Service resource
37-
path: /
38-
pathType: Prefix
39-
tls:
40-
- hosts:
41-
- {{ .Values.ui.ingress.host | quote }}
42-
secretName: {{ .Release.Name }}-tls
4317
{{- end -}}
44-
{{- end -}}

chart/values.yaml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,42 @@ ui:
112112
iconUrl: https://raw.githubusercontent.com/gradio-app/gradio/5524e590577769b0444a5332b8d444aafb0c5c12/js/app/public/static/img/logo.svg
113113
description: |
114114
A web-based user inferface for interacting with the deployed LLM.
115-
# Optional config for an ingress resource to expose the UI
116-
ingress:
117-
# The name of the ingress resource to create (default: Release.Name)
118-
name:
119-
# Any annotations to apply to the ingress resource
120-
# (e.g. for cert-manager TLS integration)
121-
annotations: {}
122-
# The domain name to use for the ingress resource.
123-
# If host is not set then ingress support will be disabled and
124-
# no ingress resource will be created.
125-
# NOTE: If ingress is enabled, an ingress controller must be installed
126-
# on the target cluster before installing this chart.
127-
# For example, see https://kubernetes.github.io/ingress-nginx/deploy/
128-
# TODO: Check what happens if ingress is enabled without a controller deployed
129-
# (probably nothing, just an unused ingress resource will be created)
130-
host:
131115
# The update strategy to use for the deployment
132116
updateStrategy:
133117
rollingUpdate:
134118
maxSurge: 25%
135119
maxUnavailable: 25%
136120

121+
# Settings for configuring ingress resources
122+
# to make the UI and/or backend API accessible
123+
# outside the cluster.
124+
# NOTE: An ingress controller must be installed
125+
# on the target cluster.
126+
ingress:
127+
# The name of the ingress class to use
128+
className: nginx
129+
host:
130+
tls: true
131+
api:
132+
enabled: false
133+
# Defaults to "{{ .Release.name }}"-api
134+
name:
135+
# This is required to be /v1 for an OpenAI API
136+
# unless we add URL rewrite functionality to the
137+
# Ingress resource templates in the future.
138+
path: /v1
139+
# Annotations to apply to the ingress resource
140+
# e.g. for cert-manager integration
141+
annotations:
142+
ui:
143+
enabled: false
144+
# Defaults to "{{ .Release.name }}"-ui
145+
name:
146+
# For a Gradio app this must be the root
147+
path: /
148+
# Annotations to apply to the ingress resource
149+
# e.g. for cert-manager integration
150+
annotations:
151+
137152
reloader:
138153
watchGlobally: false

0 commit comments

Comments
 (0)