From 95d63983a60e0ac567ba63ad621f0f8bcedf101d Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Tue, 7 Jan 2025 15:55:07 +0800 Subject: [PATCH] docsum: Use docsum-gradio-ui by default (#667) Signed-off-by: Lianhao Lu --- .../common/ui/templates/configmap.yaml | 2 -- .../common/ui/templates/deployment.yaml | 3 ++ helm-charts/docsum/Chart.yaml | 1 + helm-charts/docsum/README.md | 9 +++-- helm-charts/docsum/templates/nginx.yaml | 15 --------- helm-charts/docsum/templates/ui-nginx.yaml | 33 +++++++++++++++++++ helm-charts/docsum/values.yaml | 24 +++++++++++--- 7 files changed, 62 insertions(+), 25 deletions(-) delete mode 100644 helm-charts/docsum/templates/nginx.yaml create mode 100644 helm-charts/docsum/templates/ui-nginx.yaml diff --git a/helm-charts/common/ui/templates/configmap.yaml b/helm-charts/common/ui/templates/configmap.yaml index af6cf6fde..61f6272ac 100644 --- a/helm-charts/common/ui/templates/configmap.yaml +++ b/helm-charts/common/ui/templates/configmap.yaml @@ -37,6 +37,4 @@ data: VITE_FAQ_GEN_URL: {{ .Values.BACKEND_SERVICE_ENDPOINT | quote }} {{- else if contains "faqgen-ui" .Values.image.repository }} FAQ_BASE_URL: {{ .Values.BACKEND_SERVICE_ENDPOINT | quote }} - {{- else }} - {{- fail "Unsupported ui image: " .Values.image.repository }} {{- end }} diff --git a/helm-charts/common/ui/templates/deployment.yaml b/helm-charts/common/ui/templates/deployment.yaml index 44a3299f8..637c7a48a 100644 --- a/helm-charts/common/ui/templates/deployment.yaml +++ b/helm-charts/common/ui/templates/deployment.yaml @@ -33,6 +33,9 @@ spec: envFrom: - configMapRef: name: {{ include "ui.fullname" . }}-config + - configMapRef: + name: {{ .Release.Name }}-opea-ui-config + optional: true {{- if .Values.global.extraEnvConfig }} - configMapRef: name: {{ .Values.global.extraEnvConfig }} diff --git a/helm-charts/docsum/Chart.yaml b/helm-charts/docsum/Chart.yaml index ce30da83d..d7cac44c6 100644 --- a/helm-charts/docsum/Chart.yaml +++ b/helm-charts/docsum/Chart.yaml @@ -22,5 +22,6 @@ dependencies: - name: nginx version: 0-latest repository: "file://../common/nginx" + condition: nginx.enabled version: 0-latest appVersion: "v1.0" diff --git a/helm-charts/docsum/README.md b/helm-charts/docsum/README.md index d9f4035a1..957c55c25 100644 --- a/helm-charts/docsum/README.md +++ b/helm-charts/docsum/README.md @@ -42,14 +42,17 @@ curl http://localhost:8888/v1/docsum \ ### Verify the workload through UI -The UI has already been installed via the Helm chart. To access it, use the external IP of one your Kubernetes node along with the NGINX port. You can find the NGINX port using the following command: +The UI has already been installed via the Helm chart. To access it, use the external IP of one your Kubernetes node along with docsum-ui service nodePort(If using the default docsum gradio UI) or along with the NGINX service nodePort. You can find the corresponding port using the following command: ```bash -export port=$(kubectl get service docsum-nginx --output='jsonpath={.spec.ports[0].nodePort}') +# For docsum gradio UI +export port=$(kubectl get service docsum-docsum-ui --output='jsonpath={.spec.ports[0].nodePort}') +# For other docsum UI +# export port=$(kubectl get service docsum-nginx --output='jsonpath={.spec.ports[0].nodePort}') echo $port ``` -Open a browser to access `http://:${port}` to play with the ChatQnA workload. +Open a browser to access `http://:${port}` to play with the DocSum workload. ## Values diff --git a/helm-charts/docsum/templates/nginx.yaml b/helm-charts/docsum/templates/nginx.yaml deleted file mode 100644 index 8f1545246..000000000 --- a/helm-charts/docsum/templates/nginx.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-nginx-config - labels: - {{- include "docsum.labels" . | nindent 4 }} -data: - FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "docsum-ui") | quote }} - FRONTEND_SERVICE_PORT: {{ index .Values "docsum-ui" "service" "port" | quote }} - BACKEND_SERVICE_NAME: docsum - BACKEND_SERVICE_IP: {{ include "docsum.fullname" . | quote }} - BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} diff --git a/helm-charts/docsum/templates/ui-nginx.yaml b/helm-charts/docsum/templates/ui-nginx.yaml new file mode 100644 index 000000000..6ea311b79 --- /dev/null +++ b/helm-charts/docsum/templates/ui-nginx.yaml @@ -0,0 +1,33 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +{{- if .Values.nginx.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-nginx-config + labels: + {{- include "docsum.labels" . | nindent 4 }} +data: + FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "docsum-ui") | quote }} + FRONTEND_SERVICE_PORT: {{ index .Values "docsum-ui" "service" "port" | quote }} + BACKEND_SERVICE_NAME: docsum + BACKEND_SERVICE_IP: {{ include "docsum.fullname" . | quote }} + BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} +{{- else }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-opea-ui-config + labels: + {{- include "docsum.labels" . | nindent 4 }} +data: + BACKEND_SERVICE_ENDPOINT: {{ (printf "http://%s:%s/v1/docsum" (include "docsum.fullname" .) (toString .Values.service.port)) | quote }} + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + {{- if or .Values.global.http_proxy .Values.global.https_proxy }} + no_proxy: {{ (printf "%s,%s" (include "docsum.fullname" .) .Values.global.no_proxy) | quote }} + {{- else }} + no_proxy: {{ .Values.global.no_proxy | quote }} + {{- end }} +{{- end }} diff --git a/helm-charts/docsum/values.yaml b/helm-charts/docsum/values.yaml index 1bb5a95df..7cb5330cf 100644 --- a/helm-charts/docsum/values.yaml +++ b/helm-charts/docsum/values.yaml @@ -70,16 +70,30 @@ tgi: MAX_INPUT_LENGTH: "1024" MAX_TOTAL_TOKENS: "2048" +# Use docsum gradio UI nginx: - service: - type: NodePort - + enabled: false docsum-ui: image: - repository: opea/docsum-ui + repository: opea/docsum-gradio-ui tag: "latest" - BACKEND_SERVICE_ENDPOINT: "/v1/docsum" containerPort: 5173 + service: + type: NodePort + +# NOTE: uncomment the following settings to use other docsum UI +# nginx: +# enabled: true +# service: +# type: NodePort +# docsum-ui: +# image: +# repository: opea/docsum-ui +# tag: "latest" +# BACKEND_SERVICE_ENDPOINT: "/v1/docsum" +# containerPort: 5173 +# service: +# type: ClusterIP global: http_proxy: ""