diff --git a/helm-charts/common/embedding-usvc/Chart.yaml b/helm-charts/common/embedding-usvc/Chart.yaml index 4a9f4cd5..f844478b 100644 --- a/helm-charts/common/embedding-usvc/Chart.yaml +++ b/helm-charts/common/embedding-usvc/Chart.yaml @@ -8,3 +8,8 @@ type: application version: 0.8.0 # The embedding microservice server version appVersion: "1.0.0" +dependencies: + - name: tei + version: 0.8.0 + repository: file://../tei + condition: autodependency.enabled diff --git a/helm-charts/common/embedding-usvc/README.md b/helm-charts/common/embedding-usvc/README.md index aca91962..2df1d8ca 100644 --- a/helm-charts/common/embedding-usvc/README.md +++ b/helm-charts/common/embedding-usvc/README.md @@ -4,13 +4,42 @@ Helm chart for deploying embedding microservice. embedding-usvc depends on TEI, set TEI_EMBEDDING_ENDPOINT. -## Installing the Chart +## (Option1): Installing the chart separately: -To install the chart, run the following: +First, you need to install the tei chart, please refer to the [tei](../tei) chart for more information. + +After you've deployted the tei chart successfully, please run `kubectl get svc` to get the tei service endpoint, i.e. `http://tei`. + +To install the embedding-usvc chart, run the following: + +```console +cd GenAIInfra/helm-charts/common/embedding-usvc +export TEI_EMBEDDING_ENDPOINT="http://tei" +helm dependency update +helm install embedding-usvc . --set TEI_EMBEDDING_ENDPOINT=${TEI_EMBEDDING_ENDPOINT} +``` + +## (Option2): Installing the chart with dependencies automatically: + +```console +cd GenAIInfra/helm-charts/common/embedding-usvc +helm dependency update +helm install embedding-usvc . --set autodependency.enabled=true +``` + +## Verify + +To verify the installation, run the command `kubectl get pod` to make sure all pods are running. + +Then run the command `kubectl port-forward svc/embedding-usvc 6000:6000` to expose the embedding-usvc service for access. + +Open another terminal and run the following command to verify the service if working: ```console -$ export TEI_EMBEDDING_ENDPOINT="http://tei" -$ helm install embedding embedding-usvc --set TEI_EMBEDDING_ENDPOINT=${TEI_EMBEDDING_ENDPOINT} +curl http://localhost:6000/v1/embeddings \ + -X POST \ + -d '{"text":"hello"}' \ + -H 'Content-Type: application/json' ``` ## Values diff --git a/helm-charts/common/embedding-usvc/templates/NOTES.txt b/helm-charts/common/embedding-usvc/templates/NOTES.txt deleted file mode 100644 index 562d3f81..00000000 --- a/helm-charts/common/embedding-usvc/templates/NOTES.txt +++ /dev/null @@ -1,7 +0,0 @@ -1. Get the application IP or URL by running these commands: - export embedding_uservice_svc_ip=$(kubectl get svc --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "embedding-usvc.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].spec.clusterIP}") && echo ${embedding_uservice_svc_ip} -2. Use this command to verify tei service: - curl ${embedding_uservice_svc_ip}:6000/v1/embeddings\ - -X POST \ - -d '{"text":"hello"}' \ - -H 'Content-Type: application/json' diff --git a/helm-charts/common/embedding-usvc/templates/tests/test-pod.yaml b/helm-charts/common/embedding-usvc/templates/tests/test-pod.yaml new file mode 100644 index 00000000..ff0f0e91 --- /dev/null +++ b/helm-charts/common/embedding-usvc/templates/tests/test-pod.yaml @@ -0,0 +1,25 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "embedding-usvc.fullname" . }}-testpod" + labels: + {{- include "embedding-usvc.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test + #"helm.sh/hook-delete-policy": "hook-succeeded, hook-failure" +spec: + containers: + - name: curl + image: alpine/curl + #image: python:3.10.14 + command: ['sh', '-c'] + args: + - | + curl http://{{ include "embedding-usvc.fullname" . }}:{{ .Values.service.port }}/v1/embeddings -sS --fail-with-body \ + -X POST \ + -d '{"text":"hello"}' \ + -H 'Content-Type: application/json' + restartPolicy: Never diff --git a/helm-charts/common/embedding-usvc/values.yaml b/helm-charts/common/embedding-usvc/values.yaml index ae07e20e..930ae4fd 100644 --- a/helm-charts/common/embedding-usvc/values.yaml +++ b/helm-charts/common/embedding-usvc/values.yaml @@ -5,6 +5,9 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +autodependency: + enabled: false + replicaCount: 1 TEI_EMBEDDING_ENDPOINT: "" diff --git a/manifests/update_manifests.sh b/manifests/update_manifests.sh index f1d720a8..512cd8fe 100755 --- a/manifests/update_manifests.sh +++ b/manifests/update_manifests.sh @@ -20,6 +20,7 @@ function generate_yaml { } mkdir -p $OUTPUTDIR +${CUR_DIR}/../helm-charts/update_dependency.sh cd $CUR_DIR for chart in ${CUR_DIR}/../helm-charts/common/* do