From 7dabdf0b378f710e41fadf1fd4ef47b69bee2326 Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Thu, 11 Jul 2024 16:44:27 +0800 Subject: [PATCH] helm: support adding extra env from external configmap Allow user to add/overwrite extra environment variables by setting globa.extraEnvConfig to an external configmap. Signed-off-by: Lianhao Lu --- .../common/data-prep/templates/configmap.yaml | 29 ++++++++++++++ .../data-prep/templates/deployment.yaml | 39 ++++--------------- .../embedding-usvc/templates/configmap.yaml | 21 ++++++++++ .../embedding-usvc/templates/deployment.yaml | 27 ++++--------- .../llm-uservice/templates/configmap.yaml | 23 +++++++++++ .../llm-uservice/templates/deployment.yaml | 31 ++++----------- helm-charts/common/llm-uservice/values.yaml | 2 +- .../reranking-usvc/templates/configmap.yaml | 21 ++++++++++ .../reranking-usvc/templates/deployment.yaml | 27 ++++--------- .../retriever-usvc/templates/configmap.yaml | 29 ++++++++++++++ .../retriever-usvc/templates/deployment.yaml | 39 ++++--------------- .../common/tei/templates/configmap.yaml | 18 +++++++++ .../common/tei/templates/deployment.yaml | 25 ++++-------- .../common/teirerank/templates/configmap.yaml | 18 +++++++++ .../teirerank/templates/deployment.yaml | 25 ++++-------- .../common/tgi/templates/configmap.yaml | 23 +++++++++++ .../common/tgi/templates/deployment.yaml | 35 ++++------------- .../web-retriever/templates/configmap.yaml | 22 +++++++++++ .../web-retriever/templates/deployment.yaml | 29 ++++---------- 19 files changed, 277 insertions(+), 206 deletions(-) create mode 100644 helm-charts/common/data-prep/templates/configmap.yaml create mode 100644 helm-charts/common/embedding-usvc/templates/configmap.yaml create mode 100644 helm-charts/common/llm-uservice/templates/configmap.yaml create mode 100644 helm-charts/common/reranking-usvc/templates/configmap.yaml create mode 100644 helm-charts/common/retriever-usvc/templates/configmap.yaml create mode 100644 helm-charts/common/tei/templates/configmap.yaml create mode 100644 helm-charts/common/teirerank/templates/configmap.yaml create mode 100644 helm-charts/common/tgi/templates/configmap.yaml create mode 100644 helm-charts/common/web-retriever/templates/configmap.yaml diff --git a/helm-charts/common/data-prep/templates/configmap.yaml b/helm-charts/common/data-prep/templates/configmap.yaml new file mode 100644 index 000000000..9ec3e76ab --- /dev/null +++ b/helm-charts/common/data-prep/templates/configmap.yaml @@ -0,0 +1,29 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "data-prep.fullname" . }}-config + labels: + {{- include "data-prep.labels" . | nindent 4 }} +data: + {{- if .Values.TEI_EMBEDDING_ENDPOINT }} + TEI_ENDPOINT: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote}} + {{- else }} + TEI_ENDPOINT: "http://{{ .Release.Name }}-tei" + {{- end }} + {{- if .Values.REDIS_URL }} + REDIS_URL: {{ .Values.REDIS_URL | quote}} + {{- else }} + REDIS_URL: "redis://{{ .Release.Name }}-redis-vector-db:6379" + {{- end }} + INDEX_NAME: "rag-redis" + HUGGINGFACEHUB_API_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} + HF_HOME: "/tmp/.cache/huggingface" + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + LANGCHAIN_TRACING_V2: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} + LANGCHAIN_API_KEY: {{ .Values.global.LANGCHAIN_API_KEY | quote }} + LANGCHAIN_PROJECT: "opea-dataprep-service" diff --git a/helm-charts/common/data-prep/templates/deployment.yaml b/helm-charts/common/data-prep/templates/deployment.yaml index 96d5c7d54..16e154e79 100644 --- a/helm-charts/common/data-prep/templates/deployment.yaml +++ b/helm-charts/common/data-prep/templates/deployment.yaml @@ -29,37 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Release.Name }} - env: - - name: TEI_ENDPOINT - {{- if .Values.TEI_EMBEDDING_ENDPOINT }} - value: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote}} - {{- else }} - value: "http://{{ .Release.Name }}-tei" - {{- end }} - - name: REDIS_URL - {{- if .Values.REDIS_URL }} - value: {{ .Values.REDIS_URL | quote}} - {{- else }} - value: "redis://{{ .Release.Name }}-redis-vector-db:6379" - {{- end }} - - name: INDEX_NAME - value: "rag-redis" - - name: HUGGINGFACEHUB_API_TOKEN - value: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} - - name: HF_HOME - value: "/tmp/.cache/huggingface" - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: LANGCHAIN_TRACING_V2 - value: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} - - name: LANGCHAIN_API_KEY - value: {{ .Values.global.LANGCHAIN_API_KEY }} - - name: LANGCHAIN_PROJECT - value: "opea-dataprep-service" + envFrom: + - configMapRef: + name: {{ include "data-prep.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}" diff --git a/helm-charts/common/embedding-usvc/templates/configmap.yaml b/helm-charts/common/embedding-usvc/templates/configmap.yaml new file mode 100644 index 000000000..65037894a --- /dev/null +++ b/helm-charts/common/embedding-usvc/templates/configmap.yaml @@ -0,0 +1,21 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "embedding-usvc.fullname" . }}-config + labels: + {{- include "embedding-usvc.labels" . | nindent 4 }} +data: + {{- if .Values.TEI_EMBEDDING_ENDPOINT }} + TEI_EMBEDDING_ENDPOINT: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote }} + {{- else }} + TEI_EMBEDDING_ENDPOINT: "http://{{ .Release.Name }}-tei" + {{- end }} + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + LANGCHAIN_TRACING_V2: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} + LANGCHAIN_API_KEY: {{ .Values.global.LANGCHAIN_API_KEY }} + LANGCHAIN_PROJECT: "opea-embedding-service" diff --git a/helm-charts/common/embedding-usvc/templates/deployment.yaml b/helm-charts/common/embedding-usvc/templates/deployment.yaml index 2b05cab68..70a627fc4 100644 --- a/helm-charts/common/embedding-usvc/templates/deployment.yaml +++ b/helm-charts/common/embedding-usvc/templates/deployment.yaml @@ -29,25 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Release.Name }} - env: - - name: TEI_EMBEDDING_ENDPOINT - {{- if .Values.TEI_EMBEDDING_ENDPOINT }} - value: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote}} - {{- else }} - value: "http://{{ .Release.Name }}-tei" - {{- end }} - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: LANGCHAIN_TRACING_V2 - value: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} - - name: LANGCHAIN_API_KEY - value: {{ .Values.global.LANGCHAIN_API_KEY }} - - name: LANGCHAIN_PROJECT - value: "opea-embedding-service" + envFrom: + - configMapRef: + name: {{ include "embedding-usvc.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}" diff --git a/helm-charts/common/llm-uservice/templates/configmap.yaml b/helm-charts/common/llm-uservice/templates/configmap.yaml new file mode 100644 index 000000000..ee71c78cb --- /dev/null +++ b/helm-charts/common/llm-uservice/templates/configmap.yaml @@ -0,0 +1,23 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "llm-uservice.fullname" . }}-config + labels: + {{- include "llm-uservice.labels" . | nindent 4 }} +data: + {{- if .Values.TGI_LLM_ENDPOINT }} + TGI_LLM_ENDPOINT: {{ .Values.TGI_LLM_ENDPOINT | quote}} + {{- else }} + TGI_LLM_ENDPOINT: "http://{{ .Release.Name }}-tgi" + {{- end }} + HUGGINGFACEHUB_API_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} + HF_HOME: "/tmp/.cache/huggingface" + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + LANGCHAIN_TRACING_V2: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} + LANGCHAIN_API_KEY: {{ .Values.global.LANGCHAIN_API_KEY }} + LANGCHAIN_PROJECT: "opea-llm-uservice" diff --git a/helm-charts/common/llm-uservice/templates/deployment.yaml b/helm-charts/common/llm-uservice/templates/deployment.yaml index a2869cb94..a8a679add 100644 --- a/helm-charts/common/llm-uservice/templates/deployment.yaml +++ b/helm-charts/common/llm-uservice/templates/deployment.yaml @@ -29,29 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Release.Name }} - env: - - name: TGI_LLM_ENDPOINT - {{- if .Values.TGI_LLM_ENDPOINT }} - value: {{ .Values.TGI_LLM_ENDPOINT | quote}} - {{- else }} - value: "http://{{ .Release.Name }}-tgi" - {{- end }} - - name: HUGGINGFACEHUB_API_TOKEN - value: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} - - name: HF_HOME - value: "/tmp/.cache/huggingface" - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: LANGCHAIN_TRACING_V2 - value: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} - - name: LANGCHAIN_API_KEY - value: {{ .Values.global.LANGCHAIN_API_KEY }} - - name: LANGCHAIN_PROJECT - value: "opea-llm-service" + envFrom: + - configMapRef: + name: {{ include "llm-uservice.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}" diff --git a/helm-charts/common/llm-uservice/values.yaml b/helm-charts/common/llm-uservice/values.yaml index de81b657d..d88a01bc0 100644 --- a/helm-charts/common/llm-uservice/values.yaml +++ b/helm-charts/common/llm-uservice/values.yaml @@ -24,7 +24,7 @@ podSecurityContext: {} # fsGroup: 2000 securityContext: - readOnlyRootFilesystem: true + readOnlyRootFilesystem: false allowPrivilegeEscalation: false runAsNonRoot: true runAsUser: 1000 diff --git a/helm-charts/common/reranking-usvc/templates/configmap.yaml b/helm-charts/common/reranking-usvc/templates/configmap.yaml new file mode 100644 index 000000000..74453b36e --- /dev/null +++ b/helm-charts/common/reranking-usvc/templates/configmap.yaml @@ -0,0 +1,21 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "reranking-usvc.fullname" . }}-config + labels: + {{- include "reranking-usvc.labels" . | nindent 4 }} +data: + {{- if .Values.TEI_RERANKING_ENDPOINT }} + TEI_RERANKING_ENDPOINT: {{ .Values.TEI_RERANKING_ENDPOINT | quote }} + {{- else }} + TEI_RERANKING_ENDPOINT: "http://{{ .Release.Name }}-teirerank" + {{- end }} + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + LANGCHAIN_TRACING_V2: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} + LANGCHAIN_API_KEY: {{ .Values.global.LANGCHAIN_API_KEY | quote }} + LANGCHAIN_PROJECT: "opea-reranking-service" diff --git a/helm-charts/common/reranking-usvc/templates/deployment.yaml b/helm-charts/common/reranking-usvc/templates/deployment.yaml index 1eba9a532..8ba825780 100644 --- a/helm-charts/common/reranking-usvc/templates/deployment.yaml +++ b/helm-charts/common/reranking-usvc/templates/deployment.yaml @@ -29,25 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Release.Name }} - env: - - name: TEI_RERANKING_ENDPOINT - {{- if .Values.TEI_RERANKING_ENDPOINT }} - value: {{ .Values.TEI_RERANKING_ENDPOINT | quote}} - {{- else }} - value: "http://{{ .Release.Name }}-teirerank" - {{- end }} - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: LANGCHAIN_TRACING_V2 - value: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} - - name: LANGCHAIN_API_KEY - value: {{ .Values.global.LANGCHAIN_API_KEY }} - - name: LANGCHAIN_PROJECT - value: "opea-reranking-service" + envFrom: + - configMapRef: + name: {{ include "reranking-usvc.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}" diff --git a/helm-charts/common/retriever-usvc/templates/configmap.yaml b/helm-charts/common/retriever-usvc/templates/configmap.yaml new file mode 100644 index 000000000..4fb2c081c --- /dev/null +++ b/helm-charts/common/retriever-usvc/templates/configmap.yaml @@ -0,0 +1,29 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "retriever-usvc.fullname" . }}-config + labels: + {{- include "retriever-usvc.labels" . | nindent 4 }} +data: + {{- if .Values.TEI_EMBEDDING_ENDPOINT }} + TEI_EMBEDDING_ENDPOINT: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote }} + {{- else }} + TEI_EMBEDDING_ENDPOINT: "http://{{ .Release.Name }}-tei" + {{- end }} + {{- if .Values.REDIS_URL }} + REDIS_URL: {{ .Values.REDIS_URL | quote}} + {{- else }} + REDIS_URL: "redis://{{ .Release.Name }}-redis-vector-db:6379" + {{- end }} + INDEX_NAME: "rag-redis" + EASYOCR_MODULE_PATH: "/tmp/.EasyOCR" + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + LANGCHAIN_TRACING_V2: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} + LANGCHAIN_API_KEY: {{ .Values.global.LANGCHAIN_API_KEY | quote }} + LANGCHAIN_PROJECT: "opea-retriever-service" + HF_HOME: "/tmp/.cache/huggingface" diff --git a/helm-charts/common/retriever-usvc/templates/deployment.yaml b/helm-charts/common/retriever-usvc/templates/deployment.yaml index 7a55ae421..17710e8c4 100644 --- a/helm-charts/common/retriever-usvc/templates/deployment.yaml +++ b/helm-charts/common/retriever-usvc/templates/deployment.yaml @@ -29,37 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Release.Name }} - env: - - name: TEI_EMBEDDING_ENDPOINT - {{- if .Values.TEI_EMBEDDING_ENDPOINT }} - value: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote}} - {{- else }} - value: "http://{{ .Release.Name }}-tei" - {{- end }} - - name: REDIS_URL - {{- if .Values.REDIS_URL }} - value: {{ .Values.REDIS_URL | quote}} - {{- else }} - value: "redis://{{ .Release.Name }}-redis-vector-db:6379" - {{- end }} - - name: INDEX_NAME - value: "rag-redis" - - name: EASYOCR_MODULE_PATH - value: "/tmp/.EasyOCR" - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: LANGCHAIN_TRACING_V2 - value: {{ .Values.global.LANGCHAIN_TRACING_V2 | quote }} - - name: LANGCHAIN_API_KEY - value: {{ .Values.global.LANGCHAIN_API_KEY }} - - name: LANGCHAIN_PROJECT - value: "opea-retriever-service" - - name: HF_HOME - value: "/tmp/.cache/huggingface" + envFrom: + - configMapRef: + name: {{ include "retriever-usvc.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}" diff --git a/helm-charts/common/tei/templates/configmap.yaml b/helm-charts/common/tei/templates/configmap.yaml new file mode 100644 index 000000000..7d4e559f9 --- /dev/null +++ b/helm-charts/common/tei/templates/configmap.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "tei.fullname" . }}-config + labels: + {{- include "tei.labels" . | nindent 4 }} +data: + MODEL_ID: {{ .Values.EMBEDDING_MODEL_ID | quote }} + PORT: {{ .Values.port | quote }} + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + NUMBA_CACHE_DIR: "/tmp" + TRANSFORMERS_CACHE: "/tmp/transformers_cache" + HF_HOME: "/tmp/.cache/huggingface" diff --git a/helm-charts/common/tei/templates/deployment.yaml b/helm-charts/common/tei/templates/deployment.yaml index 3fe7b2cea..66aee4799 100644 --- a/helm-charts/common/tei/templates/deployment.yaml +++ b/helm-charts/common/tei/templates/deployment.yaml @@ -29,23 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} - env: - - name: MODEL_ID - value: {{ .Values.EMBEDDING_MODEL_ID | quote }} - - name: PORT - value: {{ .Values.port | quote }} - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: NUMBA_CACHE_DIR - value: /tmp - - name: TRANSFORMERS_CACHE - value: /tmp/transformers_cache - - name: HF_HOME - value: "/tmp/.cache/huggingface" + envFrom: + - configMapRef: + name: {{ include "tei.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- if .Values.global.modelUseHostPath }} {} diff --git a/helm-charts/common/teirerank/templates/configmap.yaml b/helm-charts/common/teirerank/templates/configmap.yaml new file mode 100644 index 000000000..015c897ee --- /dev/null +++ b/helm-charts/common/teirerank/templates/configmap.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "teirerank.fullname" . }}-config + labels: + {{- include "teirerank.labels" . | nindent 4 }} +data: + MODEL_ID: {{ .Values.RERANK_MODEL_ID | quote }} + PORT: {{ .Values.port | quote }} + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + NUMBA_CACHE_DIR: "/tmp" + TRANSFORMERS_CACHE: "/tmp/transformers_cache" + HF_HOME: "/tmp/.cache/huggingface" diff --git a/helm-charts/common/teirerank/templates/deployment.yaml b/helm-charts/common/teirerank/templates/deployment.yaml index 43d6fc2df..27f3967fa 100644 --- a/helm-charts/common/teirerank/templates/deployment.yaml +++ b/helm-charts/common/teirerank/templates/deployment.yaml @@ -29,23 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} - env: - - name: MODEL_ID - value: {{ .Values.RERANK_MODEL_ID | quote }} - - name: PORT - value: {{ .Values.port | quote }} - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: NUMBA_CACHE_DIR - value: /tmp - - name: TRANSFORMERS_CACHE - value: /tmp/transformers_cache - - name: HF_HOME - value: "/tmp/.cache/huggingface" + envFrom: + - configMapRef: + name: {{ include "teirerank.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- if .Values.global.modelUseHostPath }} {} diff --git a/helm-charts/common/tgi/templates/configmap.yaml b/helm-charts/common/tgi/templates/configmap.yaml new file mode 100644 index 000000000..aeeb5e9ff --- /dev/null +++ b/helm-charts/common/tgi/templates/configmap.yaml @@ -0,0 +1,23 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "tgi.fullname" . }}-config + labels: + {{- include "tgi.labels" . | nindent 4 }} +data: + MODEL_ID: {{ .Values.LLM_MODEL_ID | quote }} + PORT: {{ .Values.port | quote }} + HUGGING_FACE_HUB_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} + HF_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} + MAX_INPUT_TOKENS: "1024" + MAX_TOTAL_TOKENS: "4096" + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + HABANA_LOGS: "/tmp/habana_logs" + NUMBA_CACHE_DIR: "/tmp" + TRANSFORMERS_CACHE: "/tmp/transformers_cache" + HF_HOME: "/tmp/.cache/huggingface" diff --git a/helm-charts/common/tgi/templates/deployment.yaml b/helm-charts/common/tgi/templates/deployment.yaml index 674995148..53a6959b6 100644 --- a/helm-charts/common/tgi/templates/deployment.yaml +++ b/helm-charts/common/tgi/templates/deployment.yaml @@ -29,33 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} - env: - - name: MODEL_ID - value: {{ .Values.LLM_MODEL_ID }} - - name: PORT - value: {{ .Values.port | quote }} - - name: HUGGING_FACE_HUB_TOKEN - value: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} - - name: HF_TOKEN - value: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}} - - name: MAX_INPUT_TOKENS - value: "1024" - - name: MAX_TOTAL_TOKENS - value: "4096" - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: HABANA_LOGS - value: /tmp/habana_logs - - name: NUMBA_CACHE_DIR - value: /tmp/numba_cache - - name: TRANSFORMERS_CACHE - value: /tmp/transformers_cache - - name: HF_HOME - value: "/tmp/.cache/huggingface" + envFrom: + - configMapRef: + name: {{ include "tgi.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- if .Values.global.modelUseHostPath }} {} diff --git a/helm-charts/common/web-retriever/templates/configmap.yaml b/helm-charts/common/web-retriever/templates/configmap.yaml new file mode 100644 index 000000000..5a5a98b42 --- /dev/null +++ b/helm-charts/common/web-retriever/templates/configmap.yaml @@ -0,0 +1,22 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "web-retriever.fullname" . }}-config + labels: + {{- include "web-retriever.labels" . | nindent 4 }} +data: + {{- if .Values.TEI_EMBEDDING_ENDPOINT }} + TEI_EMBEDDING_ENDPOINT: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote}} + {{- else }} + TEI_EMBEDDING_ENDPOINT: "http://{{ .Release.Name }}-tei" + {{- end }} + GOOGLE_API_KEY: {{ .Values.GOOGLE_API_KEY | quote }} + GOOGLE_CSE_ID: {{ .Values.GOOGLE_CSE_ID | quote }} + EASYOCR_MODULE_PATH: "/tmp/.EasyOCR" + http_proxy: {{ .Values.global.http_proxy | quote }} + https_proxy: {{ .Values.global.https_proxy | quote }} + no_proxy: {{ .Values.global.no_proxy | quote }} + HF_HOME: "/tmp/.cache/huggingface" diff --git a/helm-charts/common/web-retriever/templates/deployment.yaml b/helm-charts/common/web-retriever/templates/deployment.yaml index 3fde72e8e..7425dac10 100644 --- a/helm-charts/common/web-retriever/templates/deployment.yaml +++ b/helm-charts/common/web-retriever/templates/deployment.yaml @@ -29,27 +29,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Release.Name }} - env: - - name: TEI_EMBEDDING_ENDPOINT - {{- if .Values.TEI_EMBEDDING_ENDPOINT }} - value: {{ .Values.TEI_EMBEDDING_ENDPOINT | quote}} - {{- else }} - value: "http://{{ .Release.Name }}-tei" - {{- end }} - - name: GOOGLE_API_KEY - value: {{ .Values.GOOGLE_API_KEY }} - - name: GOOGLE_CSE_ID - value: {{ .Values.GOOGLE_CSE_ID }} - - name: EASYOCR_MODULE_PATH - value: "/tmp/.EasyOCR" - - name: http_proxy - value: {{ .Values.global.http_proxy }} - - name: https_proxy - value: {{ .Values.global.https_proxy }} - - name: no_proxy - value: {{ .Values.global.no_proxy }} - - name: HF_HOME - value: "/tmp/.cache/huggingface" + envFrom: + - configMapRef: + name: {{ include "web-retriever.fullname" . }}-config + {{- if .Values.global.extraEnvConfig }} + - configMapRef: + name: {{ .Values.global.extraEnvConfig }} + optional: true + {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}"