diff --git a/chart/templates/api/ingress.yml b/chart/templates/api/ingress.yml new file mode 100644 index 0000000..5588688 --- /dev/null +++ b/chart/templates/api/ingress.yml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.api.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + {{ if .Values.ingress.ui.annotations -}} + annotations: + {{- .Values.ingress.api.annotations | toYaml | nindent 4 }} + {{ end -}} + name: {{ default (printf "%s-api" .Release.Name) .Values.ingress.api.name }} +spec: + ingressClassName: {{ .Values.ingress.className }} + rules: + - http: + paths: + - path: {{ .Values.ingress.api.path }} + pathType: Prefix + backend: + service: + name: {{ .Values.api.service.name }} + port: + # Must match Service resource + number: 80 + {{ if .Values.ingress.host -}} + host: {{ .Values.ingress.host | quote }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: + - hosts: + - {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }} + secretName: {{ .Release.Name }}-tls + {{- end -}} +{{- end -}} diff --git a/chart/templates/api/service.yml b/chart/templates/api/service.yml index b977164..f432145 100644 --- a/chart/templates/api/service.yml +++ b/chart/templates/api/service.yml @@ -12,4 +12,4 @@ spec: targetPort: api type: {{ .Values.api.service.type }} selector: - {{- include "azimuth-llm.api-selectorLabels" . | nindent 4 }} \ No newline at end of file + {{- include "azimuth-llm.api-selectorLabels" . | nindent 4 }} diff --git a/chart/templates/ui/ingress.yml b/chart/templates/ui/ingress.yml new file mode 100644 index 0000000..a598f85 --- /dev/null +++ b/chart/templates/ui/ingress.yml @@ -0,0 +1,32 @@ +{{- if and .Values.ui.enabled .Values.ingress.ui.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + {{ if .Values.ingress.ui.annotations -}} + annotations: + {{- .Values.ingress.ui.annotations | toYaml | nindent 4 }} + {{ end -}} + name: {{ default (printf "%s-ui" .Release.Name) .Values.ingress.ui.name }} +spec: + ingressClassName: {{ .Values.ingress.className }} + rules: + - http: + paths: + - path: {{ .Values.ingress.ui.path }} + pathType: Prefix + backend: + service: + name: {{ .Values.ui.service.name }} + port: + # Must match Service resource + number: 80 + {{ if .Values.ingress.host -}} + host: {{ .Values.ingress.host | quote }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: + - hosts: + - {{ (required "ingress.host is required when ingress.tls is true" .Values.ingress.host) | quote }} + secretName: {{ .Release.Name }}-tls + {{- end -}} +{{- end -}} diff --git a/chart/templates/ui/service.yml b/chart/templates/ui/service.yml index 5e96d95..1de5c17 100644 --- a/chart/templates/ui/service.yml +++ b/chart/templates/ui/service.yml @@ -1,5 +1,4 @@ {{- if .Values.ui.enabled -}} ---- apiVersion: v1 kind: Service metadata: @@ -15,30 +14,4 @@ spec: type: {{ .Values.ui.service.type }} selector: {{- include "azimuth-llm.ui-selectorLabels" . | nindent 4 }} ---- -{{- if .Values.ui.ingress.host -}} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - annotations: - {{- .Values.ui.ingress.annotations | toYaml | nindent 4 }} - name: {{ .Values.ui.ingress.name | default .Release.Name }} -spec: - ingressClassName: nginx - rules: - - host: {{ .Values.ui.ingress.host | quote }} - http: - paths: - - backend: - service: - name: {{ .Values.ui.service.name }} - port: - number: 80 # Must match Service resource - path: / - pathType: Prefix - tls: - - hosts: - - {{ .Values.ui.ingress.host | quote }} - secretName: {{ .Release.Name }}-tls {{- end -}} -{{- end -}} \ No newline at end of file diff --git a/chart/values.yaml b/chart/values.yaml index 47a3510..10d7b6e 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -112,27 +112,42 @@ 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. - # Optional config for an ingress resource to expose the UI - ingress: - # The name of the ingress resource to create (default: Release.Name) - name: - # Any annotations to apply to the ingress resource - # (e.g. for cert-manager TLS integration) - annotations: {} - # The domain name to use for the ingress resource. - # If host is not set then ingress support will be disabled and - # no ingress resource will be created. - # NOTE: If ingress is enabled, an ingress controller must be installed - # on the target cluster before installing this chart. - # For example, see https://kubernetes.github.io/ingress-nginx/deploy/ - # TODO: Check what happens if ingress is enabled without a controller deployed - # (probably nothing, just an unused ingress resource will be created) - host: # 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: + reloader: watchGlobally: false