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..73f1476fb 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,11 @@ affinity: {} tgi: LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 +nginx: + cmName: "{{ .Release.Name }}-nginx-config" + 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..af8691a4f 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,11 @@ vllm: guardrails-usvc: enabled: false +nginx: + cmName: "{{ .Release.Name }}-nginx-config" + 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..2f7d26e63 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,11 @@ affinity: {} tgi: LLM_MODEL_ID: Qwen/Qwen2.5-Coder-7B-Instruct +nginx: + cmName: "{{ .Release.Name }}-nginx-config" + 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..165e9288e 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,11 @@ affinity: {} tgi: LLM_MODEL_ID: mistralai/Mistral-7B-Instruct-v0.3 +nginx: + cmName: "{{ .Release.Name }}-nginx-config" + 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..523e88ae0 --- /dev/null +++ b/helm-charts/common/nginx/README.md @@ -0,0 +1,11 @@ +# OPEA nginx microservice + +Helm chart for deploying OPEA nginx service. + +## Using nginx chart + +This chart is not meant to be used standalone. It should be used with OPEA E2E helm charts as the reverse proxy for UI. + +1. In the OPEA E2E chart, define a ConfigMap containing the environment variables as defined in [OPEA nginx microservice](https://github.com/opea-project/GenAIComps/blob/main/comps/nginx/nginx.conf.template). + +2. Pass the name of the ConfigMap to helm configuration `cmName`. 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..e50c49595 --- /dev/null +++ b/helm-charts/common/nginx/templates/deployment.yaml @@ -0,0 +1,95 @@ +# 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 }} + {{- if .Values.cmName }} + envFrom: + - configMapRef: + name: {{ tpl .Values.cmName . | quote }} + {{- end }} + 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..b0e489ed2 --- /dev/null +++ b/helm-charts/common/nginx/values.yaml @@ -0,0 +1,99 @@ +# 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: {} + +# Name of the ConfigMap to be used as the environment variables +# See https://github.com/opea-project/GenAIComps/blob/main/comps/nginx/nginx.conf.template for the details of the envionrment variables +cmName: "" + +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..db88b13bf 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,11 @@ llm-uservice: tgi: LLM_MODEL_ID: Intel/neural-chat-7b-v3-3 +nginx: + cmName: "{{ .Release.Name }}-nginx-config" + 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..18b8b853a 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,11 @@ llm-uservice: tgi: LLM_MODEL_ID: meta-llama/Meta-Llama-3-8B-Instruct +nginx: + cmName: "{{ .Release.Name }}-nginx-config" + 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..8a4882f83 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,11 @@ tgi: MAX_TOTAL_TOKENS: "8192" LLM_MODEL_ID: llava-hf/llava-v1.6-mistral-7b-hf +nginx: + cmName: "{{ .Release.Name }}-nginx-config" + service: + type: NodePort + visualqna-ui: image: repository: opea/visualqna-ui