Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chatqna-ui helm chart - nginx reverse proxy #305

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions helm-charts/common/chatqna-ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ spec:
volumeMounts:
- mountPath: /tmp
name: tmp
- mountPath: /etc/nginx/conf.d
name: nginx-configuration
volumes:
- name: tmp
emptyDir: {}
- name: nginx-configuration
configMap:
name: {{ include "ui.fullname" . }}-nginx-conf
optional: false
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
39 changes: 39 additions & 0 deletions helm-charts/common/chatqna-ui/templates/nginx-conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "ui.fullname" . }}-nginx-conf
labels:
{{- include "ui.labels" . | nindent 4 }}
data:
default.conf: |-
server {
listen 80;

gzip on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types font/woff2 text/css application/javascript application/json application/font-woff application/font-tff image/gif image/png image/svg+xml application/octet-stream;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;

location ~* \.(gif|jpe?g|png|webp|ico|svg|css|js|mp4|woff2)$ {
expires 1d;
}
}

location {{ .Values.BACKEND_SERVICE_ENDPOINT }} {
proxy_pass {{ .Values.backend.scheme }}://{{ .Release.Name }}-{{ .Values.backend.name }}:{{ .Values.backend.port }}/;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to keep the meaning of BACKEND_SERVICE_ENDPOINT as the same, because docker-compose is also using it.
Also, the {{ .Release.Name }} is not necessary part of the ENDPOINT, since it's possible chatqna-ui and backend have different release name. We need to give user options to change that.
Hardcode the location shouldn't be a problem, if that is, let's define a new variable to do that.
Recommend this way:
location "/chatqna/" {
{{- if .Values.BACKEND_SERVICE_ENDPOINT }}
proxy_pass {{ .Values.BACKEND_SERVICE_ENDPOINT }}
{{- else }}
proxy_pass {{ .Values.backend.scheme }}://{{ .Release.Name }}-{{ .Values.backend.name }}:{{ .Values.backend.port }}/;
}


location {{ .Values.DATAPREP_SERVICE_ENDPOINT }} {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

proxy_pass {{ .Values.dataprep.scheme }}://{{ .Release.Name }}-{{ .Values.dataprep.name }}:{{ .Values.dataprep.port }}/;
}
}
14 changes: 12 additions & 2 deletions helm-charts/common/chatqna-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,21 @@ tolerations: []

affinity: {}

backend:
scheme: http
name: chatqna
port: 8888

dataprep:
scheme: http
name: data-prep
port: 6007

# chatQnA Mega service URL, e.g. http://<service-name>:<port>
BACKEND_SERVICE_ENDPOINT: ""
BACKEND_SERVICE_ENDPOINT: "/chatqna/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change of this variable's meaning as said above.


# data preparation service URL, http://<service-name>:<port>
DATAPREP_SERVICE_ENDPOINT: ""
DATAPREP_SERVICE_ENDPOINT: "/chatqna-data-prep/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


# data preparation get file service URL, http://<service-name>:<port>
DATAPREP_GET_FILE_ENDPOINT: ""
Expand Down
Loading