From 590991b51c94df4afd23d9b82f114fa0a8ed6ffb Mon Sep 17 00:00:00 2001 From: Eero Tamminen Date: Wed, 25 Dec 2024 09:04:24 +0200 Subject: [PATCH 1/8] Add monitoring for rest of ChatQnA + DocSum components (#655) Which provide HTTP request metrics. Signed-off-by: Eero Tamminen --- helm-charts/common/data-prep/README.md | 13 +++++++------ .../data-prep/templates/servicemonitor.yaml | 18 ++++++++++++++++++ helm-charts/common/data-prep/values.yaml | 6 ++++++ helm-charts/docsum/templates/m2t.yaml | 18 ++++++++++++++++++ helm-charts/docsum/templates/v2a.yaml | 18 ++++++++++++++++++ 5 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 helm-charts/common/data-prep/templates/servicemonitor.yaml diff --git a/helm-charts/common/data-prep/README.md b/helm-charts/common/data-prep/README.md index 4a05e2f34..ca7e2a9f8 100644 --- a/helm-charts/common/data-prep/README.md +++ b/helm-charts/common/data-prep/README.md @@ -46,12 +46,13 @@ curl http://localhost:6007/v1/dataprep \ ## Values -| Key | Type | Default | Description | -| ---------------------- | ------ | ----------------------- | ----------- | -| image.repository | string | `"opea/dataprep-redis"` | | -| service.port | string | `"6007"` | | -| REDIS_URL | string | `""` | | -| TEI_EMBEDDING_ENDPOINT | string | `""` | | +| Key | Type | Default | Description | +| ---------------------- | ------ | ----------------------- | ---------------------------------------- | +| image.repository | string | `"opea/dataprep-redis"` | | +| service.port | string | `"6007"` | | +| REDIS_URL | string | `""` | | +| TEI_EMBEDDING_ENDPOINT | string | `""` | | +| global.monitoring | bool | `false` | See ../../monitoring.md before enabling! | ## Milvus support diff --git a/helm-charts/common/data-prep/templates/servicemonitor.yaml b/helm-charts/common/data-prep/templates/servicemonitor.yaml new file mode 100644 index 000000000..9afc9ec24 --- /dev/null +++ b/helm-charts/common/data-prep/templates/servicemonitor.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +{{- if .Values.global.monitoring }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "data-prep.fullname" . }} + labels: + release: {{ .Values.global.prometheusRelease }} +spec: + selector: + matchLabels: + {{- include "data-prep.selectorLabels" . | nindent 6 }} + endpoints: + - port: data-prep + interval: 5s +{{- end }} diff --git a/helm-charts/common/data-prep/values.yaml b/helm-charts/common/data-prep/values.yaml index a8f1327c1..9073ca606 100644 --- a/helm-charts/common/data-prep/values.yaml +++ b/helm-charts/common/data-prep/values.yaml @@ -128,3 +128,9 @@ global: # If set, it will overwrite serviceAccount.name. # If set, and serviceAccount.create is false, it will assume this service account is already created by others. sharedSAName: "" + + # Install Prometheus serviceMonitors for service components + monitoring: false + + # Prometheus Helm install release name needed for serviceMonitors + prometheusRelease: prometheus-stack diff --git a/helm-charts/docsum/templates/m2t.yaml b/helm-charts/docsum/templates/m2t.yaml index 897dabf88..583156e22 100644 --- a/helm-charts/docsum/templates/m2t.yaml +++ b/helm-charts/docsum/templates/m2t.yaml @@ -85,6 +85,7 @@ metadata: name: {{ .Release.Name }}-m2t labels: {{- include "docsum.labels" . | nindent 4 }} + app: {{ .Release.Name }}-m2t spec: type: {{ .Values.m2t.service.type }} ports: @@ -95,3 +96,20 @@ spec: selector: {{- include "docsum.selectorLabels" . | nindent 4 }} app: {{ .Release.Name }}-m2t +--- +{{- if .Values.global.monitoring }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "docsum.fullname" . }}-m2t + labels: + release: {{ .Values.global.prometheusRelease }} +spec: + selector: + matchLabels: + {{- include "docsum.selectorLabels" . | nindent 6 }} + app: {{ .Release.Name }}-m2t + endpoints: + - port: m2t + interval: 5s +{{- end }} diff --git a/helm-charts/docsum/templates/v2a.yaml b/helm-charts/docsum/templates/v2a.yaml index db192bfdc..9057f415d 100644 --- a/helm-charts/docsum/templates/v2a.yaml +++ b/helm-charts/docsum/templates/v2a.yaml @@ -80,6 +80,7 @@ metadata: name: {{ .Release.Name }}-v2a labels: {{- include "docsum.labels" . | nindent 4 }} + app: {{ .Release.Name }}-v2a spec: type: {{ .Values.v2a.service.type }} ports: @@ -90,3 +91,20 @@ spec: selector: {{- include "docsum.selectorLabels" . | nindent 4 }} app: {{ .Release.Name }}-v2a +--- +{{- if .Values.global.monitoring }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "docsum.fullname" . }}-v2a + labels: + release: {{ .Values.global.prometheusRelease }} +spec: + selector: + matchLabels: + {{- include "docsum.selectorLabels" . | nindent 6 }} + app: {{ .Release.Name }}-v2a + endpoints: + - port: v2a + interval: 5s +{{- end }} From 983897b3b672655f5cf701b6ed93e6906e1106bf Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Thu, 2 Jan 2025 09:27:42 +0800 Subject: [PATCH 2/8] Use unified nginx helm chart (#636) - Add helm chart support for OPEA nginx - Use unified nginx chart in E2E Signed-off-by: Lianhao Lu --- helm-charts/audioqna/Chart.yaml | 3 + .../audioqna/templates/nginx-deployment.yaml | 107 -------------- helm-charts/audioqna/templates/nginx.yaml | 15 ++ helm-charts/audioqna/values.yaml | 8 +- helm-charts/chatqna/Chart.yaml | 3 + .../chatqna/templates/nginx-deployment.yaml | 130 ------------------ helm-charts/chatqna/templates/nginx.yaml | 17 +++ helm-charts/chatqna/values.yaml | 8 +- helm-charts/codegen/Chart.yaml | 3 + .../codegen/templates/nginx-deployment.yaml | 106 -------------- helm-charts/codegen/templates/nginx.yaml | 15 ++ helm-charts/codegen/values.yaml | 8 +- helm-charts/codetrans/Chart.yaml | 3 + .../codetrans/templates/nginx-deployment.yaml | 106 -------------- helm-charts/codetrans/templates/nginx.yaml | 15 ++ helm-charts/codetrans/values.yaml | 8 +- helm-charts/common/nginx/.helmignore | 23 ++++ helm-charts/common/nginx/Chart.yaml | 9 ++ helm-charts/common/nginx/README.md | 7 + .../common/nginx/templates/_helpers.tpl | 71 ++++++++++ .../common/nginx/templates/deployment.yaml | 94 +++++++++++++ .../templates/horizontal-pod-autoscaler.yaml | 35 +++++ .../common/nginx/templates/service.yaml | 18 +++ .../nginx/templates/serviceaccount.yaml | 16 +++ .../nginx/templates/tests/test-pod.yaml | 26 ++++ helm-charts/common/nginx/values.yaml | 95 +++++++++++++ helm-charts/docsum/Chart.yaml | 3 + .../docsum/templates/nginx-deployment.yaml | 106 -------------- helm-charts/docsum/templates/nginx.yaml | 15 ++ helm-charts/docsum/values.yaml | 8 +- helm-charts/faqgen/Chart.yaml | 3 + .../faqgen/templates/nginx-deployment.yaml | 106 -------------- helm-charts/faqgen/templates/nginx.yaml | 15 ++ helm-charts/faqgen/values.yaml | 8 +- helm-charts/visualqna/Chart.yaml | 3 + .../visualqna/templates/nginx-deployment.yaml | 107 -------------- helm-charts/visualqna/templates/nginx.yaml | 15 ++ helm-charts/visualqna/values.yaml | 7 +- 38 files changed, 550 insertions(+), 795 deletions(-) delete mode 100644 helm-charts/audioqna/templates/nginx-deployment.yaml create mode 100644 helm-charts/audioqna/templates/nginx.yaml delete mode 100644 helm-charts/chatqna/templates/nginx-deployment.yaml create mode 100644 helm-charts/chatqna/templates/nginx.yaml delete mode 100644 helm-charts/codegen/templates/nginx-deployment.yaml create mode 100644 helm-charts/codegen/templates/nginx.yaml delete mode 100644 helm-charts/codetrans/templates/nginx-deployment.yaml create mode 100644 helm-charts/codetrans/templates/nginx.yaml create mode 100644 helm-charts/common/nginx/.helmignore create mode 100644 helm-charts/common/nginx/Chart.yaml create mode 100644 helm-charts/common/nginx/README.md create mode 100644 helm-charts/common/nginx/templates/_helpers.tpl create mode 100644 helm-charts/common/nginx/templates/deployment.yaml create mode 100644 helm-charts/common/nginx/templates/horizontal-pod-autoscaler.yaml create mode 100644 helm-charts/common/nginx/templates/service.yaml create mode 100644 helm-charts/common/nginx/templates/serviceaccount.yaml create mode 100644 helm-charts/common/nginx/templates/tests/test-pod.yaml create mode 100644 helm-charts/common/nginx/values.yaml delete mode 100644 helm-charts/docsum/templates/nginx-deployment.yaml create mode 100644 helm-charts/docsum/templates/nginx.yaml delete mode 100644 helm-charts/faqgen/templates/nginx-deployment.yaml create mode 100644 helm-charts/faqgen/templates/nginx.yaml delete mode 100644 helm-charts/visualqna/templates/nginx-deployment.yaml create mode 100644 helm-charts/visualqna/templates/nginx.yaml diff --git a/helm-charts/audioqna/Chart.yaml b/helm-charts/audioqna/Chart.yaml index 2c16ebcaa..8b48e7ede 100644 --- a/helm-charts/audioqna/Chart.yaml +++ b/helm-charts/audioqna/Chart.yaml @@ -28,5 +28,8 @@ dependencies: version: 0-latest repository: "file://../common/ui" alias: audioqna-ui + - name: nginx + version: 0-latest + repository: "file://../common/nginx" version: 0-latest appVersion: "1.1" diff --git a/helm-charts/audioqna/templates/nginx-deployment.yaml b/helm-charts/audioqna/templates/nginx-deployment.yaml deleted file mode 100644 index e36eed904..000000000 --- a/helm-charts/audioqna/templates/nginx-deployment.yaml +++ /dev/null @@ -1,107 +0,0 @@ -# Remove the above switch if the audioqna-ui image is ready on dockerhub -apiVersion: v1 -data: - default.conf: |+ - # Copyright (C) 2024 Intel Corporation - # SPDX-License-Identifier: Apache-2.0 - - - server { - listen 80; - listen [::]:80; - - location /home { - alias /usr/share/nginx/html/index.html; - } - - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - client_max_body_size 10G; - - location / { - proxy_pass http://{{ include "ui.fullname" (index .Subcharts "audioqna-ui") }}:{{ index .Values "audioqna-ui" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/audioqna { - proxy_pass http://{{ include "audioqna.fullname" . }}:{{ .Values.service.port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_buffering off; - proxy_cache off; - proxy_request_buffering off; - gzip off; - } - } - -kind: ConfigMap -metadata: - name: {{ include "audioqna.fullname" . }}-nginx-config ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "audioqna.fullname" . }}-nginx - labels: - {{- include "audioqna.labels" . | nindent 4 }} - app: {{ include "audioqna.fullname" . }}-nginx -spec: - selector: - matchLabels: - {{- include "audioqna.selectorLabels" . | nindent 6 }} - app: {{ include "audioqna.fullname" . }}-nginx - template: - metadata: - labels: - {{- include "audioqna.selectorLabels" . | nindent 8 }} - app: {{ include "audioqna.fullname" . }}-nginx - spec: - containers: - - image: nginx:1.27.1 - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - name: nginx - volumeMounts: - - mountPath: /etc/nginx/conf.d - name: nginx-config-volume - securityContext: {} - volumes: - - configMap: - defaultMode: 420 - name: {{ include "audioqna.fullname" . }}-nginx-config - name: nginx-config-volume - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "audioqna.fullname" . }}-nginx -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - {{- include "audioqna.selectorLabels" . | nindent 4 }} - app: {{ include "audioqna.fullname" . }}-nginx - type: {{ .Values.nginx.service.type }} diff --git a/helm-charts/audioqna/templates/nginx.yaml b/helm-charts/audioqna/templates/nginx.yaml new file mode 100644 index 000000000..6f430d400 --- /dev/null +++ b/helm-charts/audioqna/templates/nginx.yaml @@ -0,0 +1,15 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-nginx-config + labels: + {{- include "audioqna.labels" . | nindent 4 }} +data: + FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "audioqna-ui") | quote }} + FRONTEND_SERVICE_PORT: {{ index .Values "audioqna-ui" "service" "port" | quote }} + BACKEND_SERVICE_NAME: audioqna + BACKEND_SERVICE_IP: {{ include "audioqna.fullname" . | quote }} + BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} diff --git a/helm-charts/audioqna/values.yaml b/helm-charts/audioqna/values.yaml index a305825b1..8f665a47b 100644 --- a/helm-charts/audioqna/values.yaml +++ b/helm-charts/audioqna/values.yaml @@ -50,10 +50,6 @@ service: type: ClusterIP port: 3008 -nginx: - service: - type: NodePort - nodeSelector: {} tolerations: [] @@ -64,6 +60,10 @@ affinity: {} tgi: LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 +nginx: + service: + type: NodePort + audioqna-ui: image: repository: opea/audioqna-ui diff --git a/helm-charts/chatqna/Chart.yaml b/helm-charts/chatqna/Chart.yaml index 7c52d1318..bf4ad3035 100644 --- a/helm-charts/chatqna/Chart.yaml +++ b/helm-charts/chatqna/Chart.yaml @@ -42,5 +42,8 @@ dependencies: alias: chatqna-ui version: 0-latest repository: "file://../common/ui" + - name: nginx + version: 0-latest + repository: "file://../common/nginx" version: 0-latest appVersion: "v1.0" diff --git a/helm-charts/chatqna/templates/nginx-deployment.yaml b/helm-charts/chatqna/templates/nginx-deployment.yaml deleted file mode 100644 index 8b5c897de..000000000 --- a/helm-charts/chatqna/templates/nginx-deployment.yaml +++ /dev/null @@ -1,130 +0,0 @@ -apiVersion: v1 -data: - default.conf: |+ - # Copyright (C) 2024 Intel Corporation - # SPDX-License-Identifier: Apache-2.0 - - - server { - listen 80; - listen [::]:80; - - location /home { - alias /usr/share/nginx/html/index.html; - } - - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - client_max_body_size 10G; - - location / { - proxy_pass http://{{ include "ui.fullname" (index .Subcharts "chatqna-ui") }}:{{ index .Values "chatqna-ui" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/chatqna { - proxy_pass http://{{ include "chatqna.fullname" . }}:{{ .Values.service.port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_buffering off; - proxy_cache off; - proxy_request_buffering off; - gzip off; - } - - location /v1/dataprep { - proxy_pass http://{{ include "data-prep.fullname" (index .Subcharts "data-prep") }}:{{ index .Values "data-prep" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/dataprep/get_file { - proxy_pass http://{{ include "data-prep.fullname" (index .Subcharts "data-prep") }}:{{ index .Values "data-prep" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/dataprep/delete_file { - proxy_pass http://{{ include "data-prep.fullname" (index .Subcharts "data-prep") }}:{{ index .Values "data-prep" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - } - -kind: ConfigMap -metadata: - name: {{ include "chatqna.fullname" . }}-nginx-config ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "chatqna.fullname" . }}-nginx - labels: - {{- include "chatqna.labels" . | nindent 4 }} - app: {{ include "chatqna.fullname" . }}-nginx -spec: - selector: - matchLabels: - {{- include "chatqna.selectorLabels" . | nindent 6 }} - app: {{ include "chatqna.fullname" . }}-nginx - template: - metadata: - labels: - {{- include "chatqna.selectorLabels" . | nindent 8 }} - app: {{ include "chatqna.fullname" . }}-nginx - spec: - containers: - - image: nginx:1.27.1 - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - name: nginx - volumeMounts: - - mountPath: /etc/nginx/conf.d - name: nginx-config-volume - securityContext: {} - volumes: - - configMap: - defaultMode: 420 - name: {{ include "chatqna.fullname" . }}-nginx-config - name: nginx-config-volume - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "chatqna.fullname" . }}-nginx -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - {{- include "chatqna.selectorLabels" . | nindent 4 }} - app: {{ include "chatqna.fullname" . }}-nginx - type: {{ .Values.nginx.service.type }} diff --git a/helm-charts/chatqna/templates/nginx.yaml b/helm-charts/chatqna/templates/nginx.yaml new file mode 100644 index 000000000..2fa0feb8e --- /dev/null +++ b/helm-charts/chatqna/templates/nginx.yaml @@ -0,0 +1,17 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-nginx-config + labels: + {{- include "chatqna.labels" . | nindent 4 }} +data: + FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "chatqna-ui") | quote }} + FRONTEND_SERVICE_PORT: {{ index .Values "chatqna-ui" "service" "port" | quote }} + BACKEND_SERVICE_NAME: chatqna + BACKEND_SERVICE_IP: {{ include "chatqna.fullname" . | quote }} + BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} + DATAPREP_SERVICE_IP: {{ include "data-prep.fullname" (index .Subcharts "data-prep") | quote }} + DATAPREP_SERVICE_PORT: {{ index .Values "data-prep" "service" "port" | quote }} diff --git a/helm-charts/chatqna/values.yaml b/helm-charts/chatqna/values.yaml index c939f9b9d..545964b6e 100644 --- a/helm-charts/chatqna/values.yaml +++ b/helm-charts/chatqna/values.yaml @@ -50,10 +50,6 @@ service: type: ClusterIP port: 8888 -nginx: - service: - type: NodePort - nodeSelector: {} tolerations: [] @@ -78,6 +74,10 @@ vllm: guardrails-usvc: enabled: false +nginx: + service: + type: NodePort + # If you would like to switch to traditional UI image # Uncomment the following lines # chatqna-ui: diff --git a/helm-charts/codegen/Chart.yaml b/helm-charts/codegen/Chart.yaml index bf9ba9b50..1ac2a0a12 100644 --- a/helm-charts/codegen/Chart.yaml +++ b/helm-charts/codegen/Chart.yaml @@ -16,5 +16,8 @@ dependencies: version: 0-latest repository: "file://../common/ui" alias: codegen-ui + - name: nginx + version: 0-latest + repository: "file://../common/nginx" version: 0-latest appVersion: "v1.0" diff --git a/helm-charts/codegen/templates/nginx-deployment.yaml b/helm-charts/codegen/templates/nginx-deployment.yaml deleted file mode 100644 index dfcb839f1..000000000 --- a/helm-charts/codegen/templates/nginx-deployment.yaml +++ /dev/null @@ -1,106 +0,0 @@ -apiVersion: v1 -data: - default.conf: |+ - # Copyright (C) 2024 Intel Corporation - # SPDX-License-Identifier: Apache-2.0 - - - server { - listen 80; - listen [::]:80; - - location /home { - alias /usr/share/nginx/html/index.html; - } - - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - client_max_body_size 10G; - - location / { - proxy_pass http://{{ include "ui.fullname" (index .Subcharts "codegen-ui") }}:{{ index .Values "codegen-ui" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/codegen { - proxy_pass http://{{ include "codegen.fullname" . }}:{{ .Values.service.port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_buffering off; - proxy_cache off; - proxy_request_buffering off; - gzip off; - } - } - -kind: ConfigMap -metadata: - name: {{ include "codegen.fullname" . }}-nginx-config ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "codegen.fullname" . }}-nginx - labels: - {{- include "codegen.labels" . | nindent 4 }} - app: {{ include "codegen.fullname" . }}-nginx -spec: - selector: - matchLabels: - {{- include "codegen.selectorLabels" . | nindent 6 }} - app: {{ include "codegen.fullname" . }}-nginx - template: - metadata: - labels: - {{- include "codegen.selectorLabels" . | nindent 8 }} - app: {{ include "codegen.fullname" . }}-nginx - spec: - containers: - - image: nginx:1.27.1 - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - name: nginx - volumeMounts: - - mountPath: /etc/nginx/conf.d - name: nginx-config-volume - securityContext: {} - volumes: - - configMap: - defaultMode: 420 - name: {{ include "codegen.fullname" . }}-nginx-config - name: nginx-config-volume - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "codegen.fullname" . }}-nginx -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - {{- include "codegen.selectorLabels" . | nindent 4 }} - app: {{ include "codegen.fullname" . }}-nginx - type: {{ .Values.nginx.service.type }} diff --git a/helm-charts/codegen/templates/nginx.yaml b/helm-charts/codegen/templates/nginx.yaml new file mode 100644 index 000000000..183a407dc --- /dev/null +++ b/helm-charts/codegen/templates/nginx.yaml @@ -0,0 +1,15 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-nginx-config + labels: + {{- include "codegen.labels" . | nindent 4 }} +data: + FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "codegen-ui") | quote }} + FRONTEND_SERVICE_PORT: {{ index .Values "codegen-ui" "service" "port" | quote }} + BACKEND_SERVICE_NAME: codegen + BACKEND_SERVICE_IP: {{ include "codegen.fullname" . | quote }} + BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} diff --git a/helm-charts/codegen/values.yaml b/helm-charts/codegen/values.yaml index c97e8911a..de9e2a4b9 100644 --- a/helm-charts/codegen/values.yaml +++ b/helm-charts/codegen/values.yaml @@ -50,10 +50,6 @@ service: type: ClusterIP port: 7778 -nginx: - service: - type: NodePort - nodeSelector: {} tolerations: [] @@ -64,6 +60,10 @@ affinity: {} tgi: LLM_MODEL_ID: Qwen/Qwen2.5-Coder-7B-Instruct +nginx: + service: + type: NodePort + codegen-ui: image: repository: opea/codegen-ui diff --git a/helm-charts/codetrans/Chart.yaml b/helm-charts/codetrans/Chart.yaml index bb97507d8..cd6f37944 100644 --- a/helm-charts/codetrans/Chart.yaml +++ b/helm-charts/codetrans/Chart.yaml @@ -16,5 +16,8 @@ dependencies: version: 0-latest repository: "file://../common/ui" alias: codetrans-ui + - name: nginx + version: 0-latest + repository: "file://../common/nginx" version: 0-latest appVersion: "v1.0" diff --git a/helm-charts/codetrans/templates/nginx-deployment.yaml b/helm-charts/codetrans/templates/nginx-deployment.yaml deleted file mode 100644 index 0279fa27e..000000000 --- a/helm-charts/codetrans/templates/nginx-deployment.yaml +++ /dev/null @@ -1,106 +0,0 @@ -apiVersion: v1 -data: - default.conf: |+ - # Copyright (C) 2024 Intel Corporation - # SPDX-License-Identifier: Apache-2.0 - - - server { - listen 80; - listen [::]:80; - - location /home { - alias /usr/share/nginx/html/index.html; - } - - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - client_max_body_size 10G; - - location / { - proxy_pass http://{{ include "ui.fullname" (index .Subcharts "codetrans-ui") }}:{{ index .Values "codetrans-ui" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/codetrans { - proxy_pass http://{{ include "codetrans.fullname" . }}:{{ .Values.service.port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_buffering off; - proxy_cache off; - proxy_request_buffering off; - gzip off; - } - } - -kind: ConfigMap -metadata: - name: {{ include "codetrans.fullname" . }}-nginx-config ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "codetrans.fullname" . }}-nginx - labels: - {{- include "codetrans.labels" . | nindent 4 }} - app: {{ include "codetrans.fullname" . }}-nginx -spec: - selector: - matchLabels: - {{- include "codetrans.selectorLabels" . | nindent 6 }} - app: {{ include "codetrans.fullname" . }}-nginx - template: - metadata: - labels: - {{- include "codetrans.selectorLabels" . | nindent 8 }} - app: {{ include "codetrans.fullname" . }}-nginx - spec: - containers: - - image: nginx:1.27.1 - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - name: nginx - volumeMounts: - - mountPath: /etc/nginx/conf.d - name: nginx-config-volume - securityContext: {} - volumes: - - configMap: - defaultMode: 420 - name: {{ include "codetrans.fullname" . }}-nginx-config - name: nginx-config-volume - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "codetrans.fullname" . }}-nginx -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - {{- include "codetrans.selectorLabels" . | nindent 4 }} - app: {{ include "codetrans.fullname" . }}-nginx - type: {{ .Values.nginx.service.type }} diff --git a/helm-charts/codetrans/templates/nginx.yaml b/helm-charts/codetrans/templates/nginx.yaml new file mode 100644 index 000000000..09d30ee86 --- /dev/null +++ b/helm-charts/codetrans/templates/nginx.yaml @@ -0,0 +1,15 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-nginx-config + labels: + {{- include "codetrans.labels" . | nindent 4 }} +data: + FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "codetrans-ui") | quote }} + FRONTEND_SERVICE_PORT: {{ index .Values "codetrans-ui" "service" "port" | quote }} + BACKEND_SERVICE_NAME: codetrans + BACKEND_SERVICE_IP: {{ include "codetrans.fullname" . | quote }} + BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} diff --git a/helm-charts/codetrans/values.yaml b/helm-charts/codetrans/values.yaml index e34421ed0..ba39428fa 100644 --- a/helm-charts/codetrans/values.yaml +++ b/helm-charts/codetrans/values.yaml @@ -51,10 +51,6 @@ service: type: ClusterIP port: 7777 -nginx: - service: - type: NodePort - nodeSelector: {} tolerations: [] @@ -65,6 +61,10 @@ affinity: {} tgi: LLM_MODEL_ID: mistralai/Mistral-7B-Instruct-v0.3 +nginx: + service: + type: NodePort + codetrans-ui: image: repository: opea/codetrans-ui diff --git a/helm-charts/common/nginx/.helmignore b/helm-charts/common/nginx/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm-charts/common/nginx/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm-charts/common/nginx/Chart.yaml b/helm-charts/common/nginx/Chart.yaml new file mode 100644 index 000000000..27492fb43 --- /dev/null +++ b/helm-charts/common/nginx/Chart.yaml @@ -0,0 +1,9 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v2 +appVersion: "1.1" +description: A Helm chart for Kubernetes +name: nginx +type: application +version: 0-latest diff --git a/helm-charts/common/nginx/README.md b/helm-charts/common/nginx/README.md new file mode 100644 index 000000000..af1a25309 --- /dev/null +++ b/helm-charts/common/nginx/README.md @@ -0,0 +1,7 @@ +# OPEA nginx microservice + +Helm chart for deploying OPEA nginx service. + +## Using nginx chart + +E2E charts for OPEA applications should provide ConfigMap of name `{{ .Release.Name }}-nginx-config` with the required environment variables to configure [OPEA nginx microservice](https://github.com/opea-project/GenAIComps/blob/main/comps/nginx/nginx.conf.template). diff --git a/helm-charts/common/nginx/templates/_helpers.tpl b/helm-charts/common/nginx/templates/_helpers.tpl new file mode 100644 index 000000000..ad467fbf0 --- /dev/null +++ b/helm-charts/common/nginx/templates/_helpers.tpl @@ -0,0 +1,71 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nginx.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nginx.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nginx.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nginx.labels" -}} +helm.sh/chart: {{ include "nginx.chart" . }} +{{ include "nginx.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nginx.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nginx.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nginx.serviceAccountName" -}} +{{- if .Values.global.sharedSAName }} +{{- .Values.global.sharedSAName }} +{{- else if .Values.serviceAccount.create }} +{{- default (include "nginx.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Convert chart name to a string suitable as metric prefix +*/}} +{{- define "nginx.metricPrefix" -}} +{{- include "nginx.fullname" . | replace "-" "_" | regexFind "[a-zA-Z_:][a-zA-Z0-9_:]*" }} +{{- end }} diff --git a/helm-charts/common/nginx/templates/deployment.yaml b/helm-charts/common/nginx/templates/deployment.yaml new file mode 100644 index 000000000..bb0b8eee3 --- /dev/null +++ b/helm-charts/common/nginx/templates/deployment.yaml @@ -0,0 +1,94 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nginx.fullname" . }} + labels: + {{- include "nginx.labels" . | nindent 4 }} +spec: + {{- if ne (int .Values.replicaCount) 1 }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nginx.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nginx.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nginx.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + envFrom: + - configMapRef: + name: {{ .Release.Name }}-nginx-config + optional: true + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + {{- if .Values.image.pullPolicy }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- end }} + ports: + - name: nginx + containerPort: {{ .Values.service.port }} + protocol: TCP + {{- if .Values.livenessProbe }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + {{- end }} + {{- if .Values.startupProbe }} + startupProbe: + {{- toYaml .Values.startupProbe | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.evenly_distributed }} + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + {{- include "nginx.selectorLabels" . | nindent 14 }} + {{- end }} diff --git a/helm-charts/common/nginx/templates/horizontal-pod-autoscaler.yaml b/helm-charts/common/nginx/templates/horizontal-pod-autoscaler.yaml new file mode 100644 index 000000000..6393764a6 --- /dev/null +++ b/helm-charts/common/nginx/templates/horizontal-pod-autoscaler.yaml @@ -0,0 +1,35 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nginx.fullname" . }} + labels: + {{- include "nginx.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nginx.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm-charts/common/nginx/templates/service.yaml b/helm-charts/common/nginx/templates/service.yaml new file mode 100644 index 000000000..694f47f4a --- /dev/null +++ b/helm-charts/common/nginx/templates/service.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nginx.fullname" . }} + labels: + {{- include "nginx.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: nginx + protocol: TCP + name: nginx + selector: + {{- include "nginx.selectorLabels" . | nindent 4 }} diff --git a/helm-charts/common/nginx/templates/serviceaccount.yaml b/helm-charts/common/nginx/templates/serviceaccount.yaml new file mode 100644 index 000000000..ff1bb9fb4 --- /dev/null +++ b/helm-charts/common/nginx/templates/serviceaccount.yaml @@ -0,0 +1,16 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nginx.serviceAccountName" . }} + labels: + {{- include "nginx.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/helm-charts/common/nginx/templates/tests/test-pod.yaml b/helm-charts/common/nginx/templates/tests/test-pod.yaml new file mode 100644 index 000000000..bdfdf28ec --- /dev/null +++ b/helm-charts/common/nginx/templates/tests/test-pod.yaml @@ -0,0 +1,26 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "nginx.fullname" . }}-testpod" + labels: + {{- include "nginx.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: curl + image: python:3.10.14 + command: ['bash', '-c'] + args: + - | + max_retry=20; + for ((i=1; i<=max_retry; i++)); do + curl http://{{ include "nginx.fullname" . }}:{{ .Values.service.port }}/home -sS --fail-with-body && break; + curlcode=$? + if [[ $curlcode -eq 7 ]]; then sleep 10; else echo "curl failed with code $curlcode"; exit 1; fi; + done; + if [ $i -gt $max_retry ]; then echo "test failed with maximum retry"; exit 1; fi + restartPolicy: Never diff --git a/helm-charts/common/nginx/values.yaml b/helm-charts/common/nginx/values.yaml new file mode 100644 index 000000000..58e65f44c --- /dev/null +++ b/helm-charts/common/nginx/values.yaml @@ -0,0 +1,95 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +# Default values for nginx. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +replicaCount: 1 + +# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ +image: + repository: opea/nginx + # Uncomment the following line to set desired image pull policy if needed, as one of Always, IfNotPresent, Never. + # pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# This is to override the chart name. +nameOverride: "" +fullnameOverride: "" + +# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ +serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# This is for setting Kubernetes Annotations to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +podAnnotations: {} +# This is for setting Kubernetes Labels to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # readOnlyRootFilesystem: true + # allowPrivilegeEscalation: false + # runAsNonRoot: true + # runAsUser: 1000 + # capabilities: + # drop: + # - ALL + # seccompProfile: + # type: RuntimeDefault + +# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/ +service: + # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + type: ClusterIP + # This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/ +# Note: do not use (above) "replicaCount" with HPA (Chart ignores value=1 as it's k8s default) +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 4 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +global: + # service account name to be shared with all parent/child charts. + # If set, it will overwrite serviceAccount.name. + # If set, and serviceAccount.create is false, it will assume this service account is already created by others. + sharedSAName: "" diff --git a/helm-charts/docsum/Chart.yaml b/helm-charts/docsum/Chart.yaml index 69e900c0b..ce30da83d 100644 --- a/helm-charts/docsum/Chart.yaml +++ b/helm-charts/docsum/Chart.yaml @@ -19,5 +19,8 @@ dependencies: version: 0-latest repository: "file://../common/ui" alias: docsum-ui + - name: nginx + version: 0-latest + repository: "file://../common/nginx" version: 0-latest appVersion: "v1.0" diff --git a/helm-charts/docsum/templates/nginx-deployment.yaml b/helm-charts/docsum/templates/nginx-deployment.yaml deleted file mode 100644 index 1231b6d1e..000000000 --- a/helm-charts/docsum/templates/nginx-deployment.yaml +++ /dev/null @@ -1,106 +0,0 @@ -apiVersion: v1 -data: - default.conf: |+ - # Copyright (C) 2024 Intel Corporation - # SPDX-License-Identifier: Apache-2.0 - - - server { - listen 80; - listen [::]:80; - - location /home { - alias /usr/share/nginx/html/index.html; - } - - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - client_max_body_size 10G; - - location / { - proxy_pass http://{{ include "ui.fullname" (index .Subcharts "docsum-ui") }}:{{ index .Values "docsum-ui" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/docsum { - proxy_pass http://{{ include "docsum.fullname" . }}:{{ .Values.service.port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_buffering off; - proxy_cache off; - proxy_request_buffering off; - gzip off; - } - } - -kind: ConfigMap -metadata: - name: {{ include "docsum.fullname" . }}-nginx-config ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "docsum.fullname" . }}-nginx - labels: - {{- include "docsum.labels" . | nindent 4 }} - app: {{ include "docsum.fullname" . }}-nginx -spec: - selector: - matchLabels: - {{- include "docsum.selectorLabels" . | nindent 6 }} - app: {{ include "docsum.fullname" . }}-nginx - template: - metadata: - labels: - {{- include "docsum.selectorLabels" . | nindent 8 }} - app: {{ include "docsum.fullname" . }}-nginx - spec: - containers: - - image: nginx:1.27.1 - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - name: nginx - volumeMounts: - - mountPath: /etc/nginx/conf.d - name: nginx-config-volume - securityContext: {} - volumes: - - configMap: - defaultMode: 420 - name: {{ include "docsum.fullname" . }}-nginx-config - name: nginx-config-volume - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "docsum.fullname" . }}-nginx -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - {{- include "docsum.selectorLabels" . | nindent 4 }} - app: {{ include "docsum.fullname" . }}-nginx - type: {{ .Values.nginx.service.type }} diff --git a/helm-charts/docsum/templates/nginx.yaml b/helm-charts/docsum/templates/nginx.yaml new file mode 100644 index 000000000..8f1545246 --- /dev/null +++ b/helm-charts/docsum/templates/nginx.yaml @@ -0,0 +1,15 @@ +# 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/values.yaml b/helm-charts/docsum/values.yaml index a473a15f3..3bd34790d 100644 --- a/helm-charts/docsum/values.yaml +++ b/helm-charts/docsum/values.yaml @@ -69,10 +69,6 @@ service: type: ClusterIP port: 8888 -nginx: - service: - type: NodePort - nodeSelector: {} tolerations: [] @@ -88,6 +84,10 @@ llm-uservice: tgi: LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 +nginx: + service: + type: NodePort + docsum-ui: image: repository: opea/docsum-ui diff --git a/helm-charts/faqgen/Chart.yaml b/helm-charts/faqgen/Chart.yaml index cec040219..ccb049199 100644 --- a/helm-charts/faqgen/Chart.yaml +++ b/helm-charts/faqgen/Chart.yaml @@ -16,5 +16,8 @@ dependencies: version: 0-latest repository: "file://../common/ui" alias: faqgen-ui + - name: nginx + version: 0-latest + repository: "file://../common/nginx" version: 0-latest appVersion: "v1.0" diff --git a/helm-charts/faqgen/templates/nginx-deployment.yaml b/helm-charts/faqgen/templates/nginx-deployment.yaml deleted file mode 100644 index 4c5aeedb6..000000000 --- a/helm-charts/faqgen/templates/nginx-deployment.yaml +++ /dev/null @@ -1,106 +0,0 @@ -apiVersion: v1 -data: - default.conf: |+ - # Copyright (C) 2024 Intel Corporation - # SPDX-License-Identifier: Apache-2.0 - - - server { - listen 80; - listen [::]:80; - - location /home { - alias /usr/share/nginx/html/index.html; - } - - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - client_max_body_size 10G; - - location / { - proxy_pass http://{{ include "ui.fullname" (index .Subcharts "faqgen-ui") }}:{{ index .Values "faqgen-ui" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/faqgen { - proxy_pass http://{{ include "faqgen.fullname" . }}:{{ .Values.service.port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_buffering off; - proxy_cache off; - proxy_request_buffering off; - gzip off; - } - } - -kind: ConfigMap -metadata: - name: {{ include "faqgen.fullname" . }}-nginx-config ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "faqgen.fullname" . }}-nginx - labels: - {{- include "faqgen.labels" . | nindent 4 }} - app: {{ include "faqgen.fullname" . }}-nginx -spec: - selector: - matchLabels: - {{- include "faqgen.selectorLabels" . | nindent 6 }} - app: {{ include "faqgen.fullname" . }}-nginx - template: - metadata: - labels: - {{- include "faqgen.selectorLabels" . | nindent 8 }} - app: {{ include "faqgen.fullname" . }}-nginx - spec: - containers: - - image: nginx:1.27.1 - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - name: nginx - volumeMounts: - - mountPath: /etc/nginx/conf.d - name: nginx-config-volume - securityContext: {} - volumes: - - configMap: - defaultMode: 420 - name: {{ include "faqgen.fullname" . }}-nginx-config - name: nginx-config-volume - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "faqgen.fullname" . }}-nginx -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - {{- include "faqgen.selectorLabels" . | nindent 4 }} - app: {{ include "faqgen.fullname" . }}-nginx - type: {{ .Values.nginx.service.type }} diff --git a/helm-charts/faqgen/templates/nginx.yaml b/helm-charts/faqgen/templates/nginx.yaml new file mode 100644 index 000000000..d8a62f2bc --- /dev/null +++ b/helm-charts/faqgen/templates/nginx.yaml @@ -0,0 +1,15 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-nginx-config + labels: + {{- include "faqgen.labels" . | nindent 4 }} +data: + FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "faqgen-ui") | quote }} + FRONTEND_SERVICE_PORT: {{ index .Values "faqgen-ui" "service" "port" | quote }} + BACKEND_SERVICE_NAME: faqgen + BACKEND_SERVICE_IP: {{ include "faqgen.fullname" . | quote }} + BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} diff --git a/helm-charts/faqgen/values.yaml b/helm-charts/faqgen/values.yaml index 75da4f674..02a81b3c3 100644 --- a/helm-charts/faqgen/values.yaml +++ b/helm-charts/faqgen/values.yaml @@ -50,10 +50,6 @@ service: type: ClusterIP port: 8888 -nginx: - service: - type: NodePort - nodeSelector: {} tolerations: [] @@ -69,6 +65,10 @@ llm-uservice: tgi: LLM_MODEL_ID: meta-llama/Meta-Llama-3-8B-Instruct +nginx: + service: + type: NodePort + faqgen-ui: image: repository: opea/faqgen-ui diff --git a/helm-charts/visualqna/Chart.yaml b/helm-charts/visualqna/Chart.yaml index a7e43c09b..c859afb01 100644 --- a/helm-charts/visualqna/Chart.yaml +++ b/helm-charts/visualqna/Chart.yaml @@ -16,5 +16,8 @@ dependencies: alias: visualqna-ui version: 0-latest repository: "file://../common/ui" + - name: nginx + version: 0-latest + repository: "file://../common/nginx" version: 0-latest appVersion: "v1.0" diff --git a/helm-charts/visualqna/templates/nginx-deployment.yaml b/helm-charts/visualqna/templates/nginx-deployment.yaml deleted file mode 100644 index 4745e36a1..000000000 --- a/helm-charts/visualqna/templates/nginx-deployment.yaml +++ /dev/null @@ -1,107 +0,0 @@ -apiVersion: v1 -data: - default.conf: |+ - # Copyright (C) 2024 Intel Corporation - # SPDX-License-Identifier: Apache-2.0 - - - server { - listen 80; - listen [::]:80; - - location /home { - alias /usr/share/nginx/html/index.html; - } - - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - client_max_body_size 10G; - - location / { - proxy_pass http://{{ include "ui.fullname" (index .Subcharts "visualqna-ui") }}:{{ index .Values "visualqna-ui" "service" "port" }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /v1/visualqna { - proxy_pass http://{{ include "visualqna.fullname" . }}:{{ .Values.service.port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_buffering off; - proxy_cache off; - proxy_request_buffering off; - gzip off; - } - - } - -kind: ConfigMap -metadata: - name: {{ include "visualqna.fullname" . }}-nginx-config ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "visualqna.fullname" . }}-nginx - labels: - {{- include "visualqna.labels" . | nindent 4 }} - app: {{ include "visualqna.fullname" . }}-nginx -spec: - selector: - matchLabels: - {{- include "visualqna.selectorLabels" . | nindent 6 }} - app: {{ include "visualqna.fullname" . }}-nginx - template: - metadata: - labels: - {{- include "visualqna.selectorLabels" . | nindent 8 }} - app: {{ include "visualqna.fullname" . }}-nginx - spec: - containers: - - image: nginx:1.27.1 - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - name: nginx - volumeMounts: - - mountPath: /etc/nginx/conf.d - name: nginx-config-volume - securityContext: {} - volumes: - - configMap: - defaultMode: 420 - name: {{ include "visualqna.fullname" . }}-nginx-config - name: nginx-config-volume - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "visualqna.fullname" . }}-nginx -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - {{- include "visualqna.selectorLabels" . | nindent 4 }} - app: {{ include "visualqna.fullname" . }}-nginx - type: {{ .Values.nginx.service.type }} diff --git a/helm-charts/visualqna/templates/nginx.yaml b/helm-charts/visualqna/templates/nginx.yaml new file mode 100644 index 000000000..ba000c5e9 --- /dev/null +++ b/helm-charts/visualqna/templates/nginx.yaml @@ -0,0 +1,15 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-nginx-config + labels: + {{- include "visualqna.labels" . | nindent 4 }} +data: + FRONTEND_SERVICE_IP: {{ include "ui.fullname" (index .Subcharts "visualqna-ui") | quote }} + FRONTEND_SERVICE_PORT: {{ index .Values "visualqna-ui" "service" "port" | quote }} + BACKEND_SERVICE_NAME: visualqna + BACKEND_SERVICE_IP: {{ include "visualqna.fullname" . | quote }} + BACKEND_SERVICE_PORT: {{ .Values.service.port | quote }} diff --git a/helm-charts/visualqna/values.yaml b/helm-charts/visualqna/values.yaml index 68c85e6c9..aa6e377a8 100644 --- a/helm-charts/visualqna/values.yaml +++ b/helm-charts/visualqna/values.yaml @@ -45,9 +45,6 @@ securityContext: seccompProfile: type: RuntimeDefault -nginx: - service: - type: NodePort port: 8888 service: type: ClusterIP @@ -70,6 +67,10 @@ tgi: MAX_TOTAL_TOKENS: "8192" LLM_MODEL_ID: llava-hf/llava-v1.6-mistral-7b-hf +nginx: + service: + type: NodePort + visualqna-ui: image: repository: opea/visualqna-ui From 07c163b1c4619832b777bd572568aef819106e6d Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Thu, 2 Jan 2025 10:43:57 +0800 Subject: [PATCH 3/8] audioqna: reduce microservice numbers (#661) * audioqna: reduce microservice numbers Adapt to latest changes in audioqna. Signed-off-by: Lianhao Lu * speecht5/whisper: adapt to changes of health check Signed-off-by: Lianhao Lu --------- Signed-off-by: Lianhao Lu --- helm-charts/audioqna/Chart.yaml | 9 ------- helm-charts/audioqna/gaudi-values.yaml | 6 +++++ .../audioqna/templates/deployment.yaml | 24 +++++++++---------- helm-charts/common/speecht5/values.yaml | 6 ++--- helm-charts/common/whisper/values.yaml | 6 ++--- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/helm-charts/audioqna/Chart.yaml b/helm-charts/audioqna/Chart.yaml index 8b48e7ede..fa0cac4fd 100644 --- a/helm-charts/audioqna/Chart.yaml +++ b/helm-charts/audioqna/Chart.yaml @@ -6,24 +6,15 @@ name: audioqna description: The Helm chart to deploy AudioQnA type: application dependencies: - - name: asr - version: 0-latest - repository: "file://../common/asr" - name: whisper version: 0-latest repository: "file://../common/whisper" - - name: tts - version: 0-latest - repository: "file://../common/tts" - name: speecht5 version: 0-latest repository: "file://../common/speecht5" - name: tgi version: 0-latest repository: "file://../common/tgi" - - name: llm-uservice - version: 0-latest - repository: "file://../common/llm-uservice" - name: ui version: 0-latest repository: "file://../common/ui" diff --git a/helm-charts/audioqna/gaudi-values.yaml b/helm-charts/audioqna/gaudi-values.yaml index c6a18dfa1..7630657ac 100644 --- a/helm-charts/audioqna/gaudi-values.yaml +++ b/helm-charts/audioqna/gaudi-values.yaml @@ -12,6 +12,12 @@ tgi: MAX_INPUT_LENGTH: "1024" MAX_TOTAL_TOKENS: "2048" CUDA_GRAPHS: "" + HF_HUB_DISABLE_PROGRESS_BARS: 1 + HF_HUB_ENABLE_HF_TRANSFER: 0 + ENABLE_HPU_GRAPH: true + LIMIT_HPU_GRAPH: true + USE_FLASH_ATTENTION: true + FLASH_ATTENTION_RECOMPUTE: true livenessProbe: initialDelaySeconds: 5 periodSeconds: 5 diff --git a/helm-charts/audioqna/templates/deployment.yaml b/helm-charts/audioqna/templates/deployment.yaml index 4282fc304..cbac0c336 100644 --- a/helm-charts/audioqna/templates/deployment.yaml +++ b/helm-charts/audioqna/templates/deployment.yaml @@ -34,18 +34,18 @@ spec: containers: - name: {{ .Release.Name }} env: - - name: LLM_SERVICE_HOST_IP - value: {{ include "llm-uservice.fullname" (index .Subcharts "llm-uservice") }} - - name: LLM_SERVICE_PORT - value: {{ index .Values "llm-uservice" "service" "port" | quote }} - - name: ASR_SERVICE_HOST_IP - value: {{ include "asr.fullname" (index .Subcharts "asr") }} - - name: ASR_SERVICE_PORT - value: {{ index .Values "asr" "service" "port" | quote }} - - name: TTS_SERVICE_HOST_IP - value: {{ include "tts.fullname" (index .Subcharts "tts") }} - - name: TTS_SERVICE_PORT - value: {{ index .Values "tts" "service" "port" | quote }} + - name: LLM_SERVER_HOST_IP + value: {{ include "tgi.fullname" (index .Subcharts "tgi") }} + - name: LLM_SERVER_PORT + value: "80" + - name: WHISPER_SERVER_HOST_IP + value: {{ include "whisper.fullname" (index .Subcharts "whisper") }} + - name: WHISPER_SERVER_PORT + value: {{ index .Values "whisper" "service" "port" | quote }} + - name: SPEECHT5_SERVER_HOST_IP + value: {{ include "speecht5.fullname" (index .Subcharts "speecht5") }} + - name: SPEECHT5_SERVER_PORT + value: {{ index .Values "speecht5" "service" "port" | quote }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" diff --git a/helm-charts/common/speecht5/values.yaml b/helm-charts/common/speecht5/values.yaml index d61433069..386b385a9 100644 --- a/helm-charts/common/speecht5/values.yaml +++ b/helm-charts/common/speecht5/values.yaml @@ -70,20 +70,20 @@ resources: {} livenessProbe: httpGet: - path: /v1/health + path: /health port: speecht5 initialDelaySeconds: 5 periodSeconds: 5 failureThreshold: 24 readinessProbe: httpGet: - path: /v1/health + path: /health port: speecht5 initialDelaySeconds: 5 periodSeconds: 5 startupProbe: httpGet: - path: /v1/health + path: /health port: speecht5 initialDelaySeconds: 5 periodSeconds: 5 diff --git a/helm-charts/common/whisper/values.yaml b/helm-charts/common/whisper/values.yaml index 74c101e6b..5e3cf92b2 100644 --- a/helm-charts/common/whisper/values.yaml +++ b/helm-charts/common/whisper/values.yaml @@ -69,20 +69,20 @@ resources: {} livenessProbe: httpGet: - path: /v1/health + path: /health port: whisper initialDelaySeconds: 5 periodSeconds: 5 failureThreshold: 24 readinessProbe: httpGet: - path: /v1/health + path: /health port: whisper initialDelaySeconds: 5 periodSeconds: 5 startupProbe: httpGet: - path: /v1/health + path: /health port: whisper initialDelaySeconds: 5 periodSeconds: 5 From e1f5c5a7814411619df3c1d3faafd92a08872ba5 Mon Sep 17 00:00:00 2001 From: dolpher Date: Thu, 2 Jan 2025 15:12:24 +0800 Subject: [PATCH 4/8] Make chatqna components configurable (#653) * Configurable subcharts Signed-off-by: Dolpher Du * Enable guardrails config Signed-off-by: Dolpher Du * Enable norerank and withwrapper config Signed-off-by: Dolpher Du * Remove incorrect comments Co-authored-by: Eero Tamminen Signed-off-by: Dolpher Du --------- Signed-off-by: Dolpher Du Co-authored-by: Eero Tamminen --- helm-charts/chatqna/Chart.yaml | 16 +++++++++++++- .../chatqna/guardrails-gaudi-values.yaml | 1 + helm-charts/chatqna/guardrails-values.yaml | 1 + helm-charts/chatqna/norerank-values.yaml | 11 ++++++++++ helm-charts/chatqna/templates/deployment.yaml | 12 +++++++++++ helm-charts/chatqna/values.yaml | 21 +++++++++++++++++-- helm-charts/chatqna/withwrapper-values.yaml | 12 +++++++++++ 7 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 helm-charts/chatqna/norerank-values.yaml create mode 100644 helm-charts/chatqna/withwrapper-values.yaml diff --git a/helm-charts/chatqna/Chart.yaml b/helm-charts/chatqna/Chart.yaml index bf4ad3035..a23a36668 100644 --- a/helm-charts/chatqna/Chart.yaml +++ b/helm-charts/chatqna/Chart.yaml @@ -10,7 +10,7 @@ dependencies: version: 0-latest alias: tgi-guardrails repository: "file://../common/tgi" - condition: guardrails-usvc.enabled + condition: tgi-guardrails.enabled - name: guardrails-usvc version: 0-latest repository: "file://../common/guardrails-usvc" @@ -23,15 +23,29 @@ dependencies: version: 0-latest repository: "file://../common/vllm" condition: vllm.enabled + - name: llm-uservice + version: 0-latest + repository: "file://../common/llm-uservice" + condition: llm-uservice.enabled - name: tei version: 0-latest repository: "file://../common/tei" + - name: embedding-usvc + version: 0-latest + repository: "file://../common/embedding-usvc" + condition: embedding-usvc.enabled - name: teirerank version: 0-latest repository: "file://../common/teirerank" + condition: teirerank.enabled + - name: reranking-usvc + version: 0-latest + repository: "file://../common/reranking-usvc" + condition: reranking-usvc.enabled - name: redis-vector-db version: 0-latest repository: "file://../common/redis-vector-db" + condition: redis-vector-db.enabled - name: retriever-usvc version: 0-latest repository: "file://../common/retriever-usvc" diff --git a/helm-charts/chatqna/guardrails-gaudi-values.yaml b/helm-charts/chatqna/guardrails-gaudi-values.yaml index 2d8192abe..6edc7febe 100644 --- a/helm-charts/chatqna/guardrails-gaudi-values.yaml +++ b/helm-charts/chatqna/guardrails-gaudi-values.yaml @@ -77,6 +77,7 @@ tgi: failureThreshold: 120 tgi-guardrails: + enabled: true accelDevice: "gaudi" LLM_MODEL_ID: "meta-llama/Meta-Llama-Guard-2-8B" image: diff --git a/helm-charts/chatqna/guardrails-values.yaml b/helm-charts/chatqna/guardrails-values.yaml index 8a0603bcc..f83507f19 100644 --- a/helm-charts/chatqna/guardrails-values.yaml +++ b/helm-charts/chatqna/guardrails-values.yaml @@ -11,4 +11,5 @@ guardrails-usvc: # SAFETY_GUARD_ENDPOINT: "http://{{ .Release.Name }}-tgi-guardrails" SAFETY_GUARD_MODEL_ID: "meta-llama/Meta-Llama-Guard-2-8B" tgi-guardrails: + enabled: true LLM_MODEL_ID: "meta-llama/Meta-Llama-Guard-2-8B" diff --git a/helm-charts/chatqna/norerank-values.yaml b/helm-charts/chatqna/norerank-values.yaml new file mode 100644 index 000000000..aa069c1c7 --- /dev/null +++ b/helm-charts/chatqna/norerank-values.yaml @@ -0,0 +1,11 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +# Accelerate inferencing in heaviest components to improve performance +# by overriding their subchart values + +image: + repository: opea/chatqna-without-rerank + +teirerank: + enabled: false diff --git a/helm-charts/chatqna/templates/deployment.yaml b/helm-charts/chatqna/templates/deployment.yaml index 4a1a1e31c..e64f84e9e 100644 --- a/helm-charts/chatqna/templates/deployment.yaml +++ b/helm-charts/chatqna/templates/deployment.yaml @@ -64,6 +64,18 @@ spec: value: {{ .Release.Name }}-guardrails-usvc - name: GUARDRAIL_SERVICE_PORT value: "9090" + - name: LLM_SERVICE_HOST_IP + value: {{ .Release.Name }}-llm-uservice + - name: LLM_SERVICE_PORT + value: "9000" + - name: RERANK_SERVICE_HOST_IP + value: {{ .Release.Name }}-reranking-usvc + - name: RERANK_SERVICE_PORT + value: "8000" + - name: EMBEDDING_SERVICE_HOST_IP + value: {{ .Release.Name }}-embedding-usvc + - name: EMBEDDING_SERVICE_PORT + value: "6000" {{- if .Values.LOGFLAG }} - name: LOGFLAG value: {{ .Values.LOGFLAG | quote }} diff --git a/helm-charts/chatqna/values.yaml b/helm-charts/chatqna/values.yaml index 545964b6e..35a243c81 100644 --- a/helm-charts/chatqna/values.yaml +++ b/helm-charts/chatqna/values.yaml @@ -61,7 +61,8 @@ affinity: {} autoscaling: enabled: false -# Override values in specific subcharts +# Optional subcharts enablement and subcharts settings overwritten +# LLM choice, tgi by default. tgi: enabled: true LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 @@ -69,10 +70,26 @@ vllm: enabled: false LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 -# disable guardrails-usvc by default +# disable guardrails by default # See guardrails-values.yaml for guardrail related options guardrails-usvc: enabled: false +tgi-guardrails: + enabled: false + +# reranking +teirerank: + enabled: true +# vector db choice, redis by default. +redis-vector-db: + enabled: true +# Microservice layer, disabled by default +llm-uservice: + enabled: false +embedding-usvc: + enabled: false +reranking-usvc: + enabled: false nginx: service: diff --git a/helm-charts/chatqna/withwrapper-values.yaml b/helm-charts/chatqna/withwrapper-values.yaml new file mode 100644 index 000000000..2874787be --- /dev/null +++ b/helm-charts/chatqna/withwrapper-values.yaml @@ -0,0 +1,12 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +image: + repository: opea/chatqna-wrapper + +llm-uservice: + enabled: true +embedding-usvc: + enabled: true +reranking-usvc: + enabled: true From 68e7d062c007f598f63b5bfde43af10aea67d747 Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Thu, 2 Jan 2025 15:23:27 +0800 Subject: [PATCH 5/8] docsum: reduce microservices in docsum (#659) Update latest changes to docsum Signed-off-by: Lianhao Lu --- .../common/llm-uservice/ci-docsum-values.yaml | 6 + .../llm-uservice/templates/configmap.yaml | 19 ++- helm-charts/common/llm-uservice/values.yaml | 2 + .../llm-uservice/variant_docsum-values.yaml | 3 + helm-charts/docsum/gaudi-values.yaml | 6 +- helm-charts/docsum/templates/deployment.yaml | 14 +-- helm-charts/docsum/templates/m2t.yaml | 115 ------------------ .../docsum/templates/tests/test-pod.yaml | 6 +- helm-charts/docsum/templates/v2a.yaml | 110 ----------------- helm-charts/docsum/values.yaml | 24 +--- 10 files changed, 45 insertions(+), 260 deletions(-) delete mode 100644 helm-charts/docsum/templates/m2t.yaml delete mode 100644 helm-charts/docsum/templates/v2a.yaml diff --git a/helm-charts/common/llm-uservice/ci-docsum-values.yaml b/helm-charts/common/llm-uservice/ci-docsum-values.yaml index b9f269c5a..da00321e2 100644 --- a/helm-charts/common/llm-uservice/ci-docsum-values.yaml +++ b/helm-charts/common/llm-uservice/ci-docsum-values.yaml @@ -4,5 +4,11 @@ image: repository: opea/llm-docsum-tgi tag: "latest" + +MAX_INPUT_TOKENS: 2048 +MAX_TOTAL_TOKENS: 4096 + tgi: enabled: true + MAX_INPUT_LENGTH: 2048 + MAX_TOTAL_TOKENS: 4096 diff --git a/helm-charts/common/llm-uservice/templates/configmap.yaml b/helm-charts/common/llm-uservice/templates/configmap.yaml index bd49777dc..0df8bd2dc 100644 --- a/helm-charts/common/llm-uservice/templates/configmap.yaml +++ b/helm-charts/common/llm-uservice/templates/configmap.yaml @@ -9,22 +9,31 @@ metadata: {{- include "llm-uservice.labels" . | nindent 4 }} data: {{- if .Values.TGI_LLM_ENDPOINT }} - TGI_LLM_ENDPOINT: {{ .Values.TGI_LLM_ENDPOINT | quote}} + TGI_LLM_ENDPOINT: {{ .Values.TGI_LLM_ENDPOINT | quote }} {{- else }} TGI_LLM_ENDPOINT: "http://{{ .Release.Name }}-tgi" {{- end }} {{- if .Values.vLLM_ENDPOINT }} - vLLM_ENDPOINT: {{ .Values.vLLM_ENDPOINT | quote}} + vLLM_ENDPOINT: {{ .Values.vLLM_ENDPOINT | quote }} {{- else }} vLLM_ENDPOINT: "http://{{ .Release.Name }}-vllm" {{- end }} {{- if .Values.LLM_MODEL_ID }} - LLM_MODEL: {{ .Values.LLM_MODEL_ID | quote}} + # NOTE: + # delete LLM_MODEL once https://github.com/opea-project/GenAIComps/pull/1089 is merged + LLM_MODEL: {{ .Values.LLM_MODEL_ID | quote }} + LLM_MODEL_ID: {{ .Values.LLM_MODEL_ID | quote }} {{- end }} - HUGGINGFACEHUB_API_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} + {{- if .Values.MAX_INPUT_TOKENS }} + MAX_INPUT_TOKENS: {{ .Values.MAX_INPUT_TOKENS | quote }} + {{- end }} + {{- if .Values.MAX_TOTAL_TOKENS }} + MAX_TOTAL_TOKENS: {{ .Values.MAX_TOTAL_TOKENS | quote }} + {{- end }} + HUGGINGFACEHUB_API_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote }} HF_HOME: "/tmp/.cache/huggingface" {{- if .Values.global.HF_ENDPOINT }} - HF_ENDPOINT: {{ .Values.global.HF_ENDPOINT | quote}} + HF_ENDPOINT: {{ .Values.global.HF_ENDPOINT | quote }} {{- end }} http_proxy: {{ .Values.global.http_proxy | quote }} https_proxy: {{ .Values.global.https_proxy | quote }} diff --git a/helm-charts/common/llm-uservice/values.yaml b/helm-charts/common/llm-uservice/values.yaml index 84ae7d32a..fc9f8788f 100644 --- a/helm-charts/common/llm-uservice/values.yaml +++ b/helm-charts/common/llm-uservice/values.yaml @@ -16,6 +16,8 @@ TGI_LLM_ENDPOINT: "" # For vllm, set the LLM_MODEL_ID the same as vllm sub chart vLLM_ENDPOINT: "" LLM_MODEL_ID: "" +MAX_INPUT_TOKENS: "" +MAX_TOTAL_TOKENS: "" # Set it as a non-null string, such as true, if you want to enable logging facility, # otherwise, keep it as "" to disable it. diff --git a/helm-charts/common/llm-uservice/variant_docsum-values.yaml b/helm-charts/common/llm-uservice/variant_docsum-values.yaml index 9e1f33bde..f0819540a 100644 --- a/helm-charts/common/llm-uservice/variant_docsum-values.yaml +++ b/helm-charts/common/llm-uservice/variant_docsum-values.yaml @@ -4,3 +4,6 @@ image: repository: opea/llm-docsum-tgi tag: "latest" + +MAX_INPUT_TOKENS: 2048 +MAX_TOTAL_TOKENS: 4096 diff --git a/helm-charts/docsum/gaudi-values.yaml b/helm-charts/docsum/gaudi-values.yaml index e5367383a..bbd8f36ad 100644 --- a/helm-charts/docsum/gaudi-values.yaml +++ b/helm-charts/docsum/gaudi-values.yaml @@ -9,9 +9,11 @@ tgi: resources: limits: habana.ai/gaudi: 1 - MAX_INPUT_LENGTH: "1024" - MAX_TOTAL_TOKENS: "2048" CUDA_GRAPHS: "" + ENABLE_HPU_GRAPH: true + LIMIT_HPU_GRAPH: true + USE_FLASH_ATTENTION: true + FLASH_ATTENTION_RECOMPUTE: true livenessProbe: initialDelaySeconds: 5 periodSeconds: 5 diff --git a/helm-charts/docsum/templates/deployment.yaml b/helm-charts/docsum/templates/deployment.yaml index cc2a281a4..486820715 100644 --- a/helm-charts/docsum/templates/deployment.yaml +++ b/helm-charts/docsum/templates/deployment.yaml @@ -35,13 +35,13 @@ spec: - name: {{ .Release.Name }} env: - name: LLM_SERVICE_HOST_IP - {{- if .Values.LLM_SERVICE_HOST_IP }} - value: {{ .Values.LLM_SERVICE_HOST_IP | quote}} - {{- else }} - value: {{ .Release.Name }}-llm-uservice - {{- end }} - - name: DATA_SERVICE_HOST_IP - value: {{ .Release.Name }}-m2t + value: {{ include "llm-uservice.fullname" (index .Subcharts "llm-uservice") }} + - name: LLM_SERVICE_PORT + value: {{ index .Values "llm-uservice" "service" "port" | quote }} + - name: ASR_SERVICE_HOST_IP + value: {{ include "whisper.fullname" (index .Subcharts "whisper") }} + - name: ASR_SERVICE_PORT + value: {{ index .Values "whisper" "service" "port" | quote }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" diff --git a/helm-charts/docsum/templates/m2t.yaml b/helm-charts/docsum/templates/m2t.yaml deleted file mode 100644 index 583156e22..000000000 --- a/helm-charts/docsum/templates/m2t.yaml +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ .Release.Name }}-m2t - labels: - {{- include "docsum.labels" . | nindent 4 }} - app: {{ .Release.Name }}-m2t -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{- include "docsum.selectorLabels" . | nindent 6 }} - app: {{ .Release.Name }}-m2t - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "docsum.selectorLabels" . | nindent 8 }} - app: {{ .Release.Name }}-m2t - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "docsum.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Release.Name }}-m2t - env: - - name: V2A_ENDPOINT - value: {{ .Release.Name }}-v2a:{{ .Values.v2a.service.port }} - - name: A2T_ENDPOINT - value: {{ .Release.Name }}-whisper:{{ .Values.whisper.service.port }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.m2t.image.repository }}:{{ .Values.m2t.image.tag | default .Chart.AppVersion }}" - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - volumeMounts: - - mountPath: /tmp - name: tmp - ports: - - name: m2t - containerPort: {{ .Values.m2t.port }} - protocol: TCP - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumes: - - name: tmp - emptyDir: {} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- if .Values.evenly_distributed }} - topologySpreadConstraints: - - maxSkew: 1 - topologyKey: kubernetes.io/hostname - whenUnsatisfiable: ScheduleAnyway - labelSelector: - matchLabels: - {{- include "docsum.selectorLabels" . | nindent 14 }} - app: {{ .Release.Name }}-m2t - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ .Release.Name }}-m2t - labels: - {{- include "docsum.labels" . | nindent 4 }} - app: {{ .Release.Name }}-m2t -spec: - type: {{ .Values.m2t.service.type }} - ports: - - port: {{ .Values.m2t.service.port }} - targetPort: {{ .Values.m2t.port }} - protocol: TCP - name: m2t - selector: - {{- include "docsum.selectorLabels" . | nindent 4 }} - app: {{ .Release.Name }}-m2t ---- -{{- if .Values.global.monitoring }} -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: {{ include "docsum.fullname" . }}-m2t - labels: - release: {{ .Values.global.prometheusRelease }} -spec: - selector: - matchLabels: - {{- include "docsum.selectorLabels" . | nindent 6 }} - app: {{ .Release.Name }}-m2t - endpoints: - - port: m2t - interval: 5s -{{- end }} diff --git a/helm-charts/docsum/templates/tests/test-pod.yaml b/helm-charts/docsum/templates/tests/test-pod.yaml index 3c63d346b..6a64874a7 100644 --- a/helm-charts/docsum/templates/tests/test-pod.yaml +++ b/helm-charts/docsum/templates/tests/test-pod.yaml @@ -21,9 +21,11 @@ spec: for ((i=1; i<=max_retry; i++)); do curl http://{{ include "docsum.fullname" . }}:{{ .Values.service.port }}/v1/docsum -sS --fail-with-body \ -H 'Content-Type: multipart/form-data' \ - -H "type=text" \ + -F "type=text" \ -F "messages=Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5." \ - -F "max_tokens=32" && break; + -F "max_tokens=32" \ + -F "language=en" \ + -F "stream=true" && break; curlcode=$? if [[ $curlcode -eq 7 ]]; then sleep 10; else echo "curl failed with code $curlcode"; exit 1; fi; done; diff --git a/helm-charts/docsum/templates/v2a.yaml b/helm-charts/docsum/templates/v2a.yaml deleted file mode 100644 index 9057f415d..000000000 --- a/helm-charts/docsum/templates/v2a.yaml +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ .Release.Name }}-v2a - labels: - {{- include "docsum.labels" . | nindent 4 }} - app: {{ .Release.Name }}-v2a -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{- include "docsum.selectorLabels" . | nindent 6 }} - app: {{ .Release.Name }}-v2a - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "docsum.selectorLabels" . | nindent 8 }} - app: {{ .Release.Name }}-v2a - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "docsum.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Release.Name }}-v2a - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.v2a.image.repository }}:{{ .Values.v2a.image.tag | default .Chart.AppVersion }}" - {{- if .Values.image.pullPolicy }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- end }} - volumeMounts: - - mountPath: /tmp - name: tmp - ports: - - name: v2a - containerPort: {{ .Values.v2a.port }} - protocol: TCP - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumes: - - name: tmp - emptyDir: {} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- if .Values.evenly_distributed }} - topologySpreadConstraints: - - maxSkew: 1 - topologyKey: kubernetes.io/hostname - whenUnsatisfiable: ScheduleAnyway - labelSelector: - matchLabels: - {{- include "docsum.selectorLabels" . | nindent 14 }} - app: {{ .Release.Name }}-v2a - {{- end }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ .Release.Name }}-v2a - labels: - {{- include "docsum.labels" . | nindent 4 }} - app: {{ .Release.Name }}-v2a -spec: - type: {{ .Values.v2a.service.type }} - ports: - - port: {{ .Values.v2a.service.port }} - targetPort: {{ .Values.v2a.port }} - protocol: TCP - name: v2a - selector: - {{- include "docsum.selectorLabels" . | nindent 4 }} - app: {{ .Release.Name }}-v2a ---- -{{- if .Values.global.monitoring }} -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: {{ include "docsum.fullname" . }}-v2a - labels: - release: {{ .Values.global.prometheusRelease }} -spec: - selector: - matchLabels: - {{- include "docsum.selectorLabels" . | nindent 6 }} - app: {{ .Release.Name }}-v2a - endpoints: - - port: v2a - interval: 5s -{{- end }} diff --git a/helm-charts/docsum/values.yaml b/helm-charts/docsum/values.yaml index 3bd34790d..1bb5a95df 100644 --- a/helm-charts/docsum/values.yaml +++ b/helm-charts/docsum/values.yaml @@ -6,7 +6,6 @@ # Declare variables to be passed into your templates. replicaCount: 1 -LLM_SERVICE_HOST_IP: "" image: repository: opea/docsum @@ -14,24 +13,6 @@ image: # pullPolicy: "" # Overrides the image tag whose default is the chart appVersion. tag: "latest" -v2a: - image: - repository: opea/dataprep-video2audio - # Overrides the image tag whose default is the chart appVersion. - tag: "latest" - port: 7078 - service: - type: ClusterIP - port: 7078 -m2t: - image: - repository: opea/dataprep-multimedia2text - # Overrides the image tag whose default is the chart appVersion. - tag: "latest" - port: 7079 - service: - type: ClusterIP - port: 7079 imagePullSecrets: [] nameOverride: "" @@ -79,10 +60,15 @@ affinity: {} llm-uservice: image: repository: opea/llm-docsum-tgi + MAX_INPUT_TOKENS: "1024" + MAX_TOTAL_TOKENS: "2048" + LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 # To override values in subchart tgi tgi: LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 + MAX_INPUT_LENGTH: "1024" + MAX_TOTAL_TOKENS: "2048" nginx: service: From 95d63983a60e0ac567ba63ad621f0f8bcedf101d Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Tue, 7 Jan 2025 15:55:07 +0800 Subject: [PATCH 6/8] 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: "" From 1fcde6d853f984da130be23900cf567b7b1055b2 Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Tue, 7 Jan 2025 17:11:50 +0800 Subject: [PATCH 7/8] Change license template 2024 to 2025 (#675) Signed-off-by: ZePan110 --- .github/license_template.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/license_template.txt b/.github/license_template.txt index b43bb9dc8..d5ad5c891 100644 --- a/.github/license_template.txt +++ b/.github/license_template.txt @@ -1,2 +1,2 @@ -Copyright (C) 2024 Intel Corporation +Copyright (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0 \ No newline at end of file From d9e5ed02e4384894a49897fe4d56a34ab29fc302 Mon Sep 17 00:00:00 2001 From: dolpher Date: Wed, 8 Jan 2025 17:41:52 +0800 Subject: [PATCH 8/8] Add workflow to automatically update helm chart 0-latest release (#673) * Add workflow to automatically update helm chart 0-latest release Signed-off-by: Dolpher Du * Add Copyright Signed-off-by: Dolpher Du * Add version check for e2e test Signed-off-by: Dolpher Du --------- Signed-off-by: Dolpher Du --- .github/workflows/pr-chart-e2e.yaml | 4 ++ .github/workflows/releasedevhelm.yaml | 66 +++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/releasedevhelm.yaml diff --git a/.github/workflows/pr-chart-e2e.yaml b/.github/workflows/pr-chart-e2e.yaml index 75e5de196..a5cce1197 100644 --- a/.github/workflows/pr-chart-e2e.yaml +++ b/.github/workflows/pr-chart-e2e.yaml @@ -34,6 +34,10 @@ jobs: - name: Get test matrix id: get-test-matrix run: | + if grep -r '^version: ' `find helm-charts/ -name "Chart.yaml"` | grep -v "0-latest"; then + echo "Version check failed, main branch should always use version 0-latest" + exit 1 + fi base_commit=${{ github.event.pull_request.base.sha }} merged_commit=$(git log -1 --format='%H') e2e_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \ diff --git a/.github/workflows/releasedevhelm.yaml b/.github/workflows/releasedevhelm.yaml new file mode 100644 index 000000000..450f8025f --- /dev/null +++ b/.github/workflows/releasedevhelm.yaml @@ -0,0 +1,66 @@ +# Copyright (C) 2025 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Update the helm charts 0-latest + +on: + pull_request: + branches: + - main + types: [closed] + paths: + - helm-charts/** +env: + CHARTS_DIR: "helm-charts" + +jobs: + run-on-merge: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + + - name: Get the modified charts list + run: | + echo "This job runs after a PR is merged!" + if grep -r '^version: ' `find helm-charts/ -name "Chart.yaml"` | grep -v "0-latest"; then + echo "Version check failed, only update 0-latest" + exit 1 + fi + base_commit=${{ github.event.pull_request.base.sha }} + merged_commit=$(git log -1 --format='%H') + # Update components + common_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \ + grep "^$CHARTS_DIR/common" | \ + grep -vE 'README.md|*.sh' | \ + cut -d'/' -f3 | sort -u ) + echo "Charts to be updated: $common_charts" + echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u opea --password-stdin + pushd $CHARTS_DIR/common + for chart in ${common_charts}; do + echo "Updating $chart" + helm dependency update ${chart} + helm package $chart + helm push ${chart}-0-latest.tgz oci://ghcr.io/opea-project/charts + done + popd + # Update Examples + e2e_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \ + grep -v "common" | \ + grep -vE 'README.md|*.sh' | \ + cut -d'/' -f2 | sort -u ) + echo "Charts to be updated: $e2e_charts" + echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u opea --password-stdin + pushd $CHARTS_DIR + for chart in ${e2e_charts}; do + echo "Updating $chart" + helm dependency update ${chart} + helm package $chart + helm push ${chart}-0-latest.tgz oci://ghcr.io/opea-project/charts + done + popd