diff --git a/helm-charts/common/reranking-usvc/Chart.yaml b/helm-charts/common/reranking-usvc/Chart.yaml index cbd2cfe0..5366255f 100644 --- a/helm-charts/common/reranking-usvc/Chart.yaml +++ b/helm-charts/common/reranking-usvc/Chart.yaml @@ -8,3 +8,8 @@ type: application version: 0.8.0 # The reranking microservice server version appVersion: "1.0.0" +dependencies: + - name: teirerank + version: 0.8.0 + repository: file://../teirerank + condition: autodependency.enabled diff --git a/helm-charts/common/reranking-usvc/README.md b/helm-charts/common/reranking-usvc/README.md index 2b64a307..491bc544 100644 --- a/helm-charts/common/reranking-usvc/README.md +++ b/helm-charts/common/reranking-usvc/README.md @@ -2,15 +2,44 @@ Helm chart for deploying reranking microservice. -reranking-usvc depends on TEI, set the TEI_RERANKING_ENDPOINT as teirerank endpoint. +reranking-usvc depends on teirerank, set the TEI_RERANKING_ENDPOINT as teirerank endpoint. -## Installing the Chart +## (Option1): Installing the chart separately: -To install the chart, run the following: +First, you need to install the teirerank chart, please refer to the [teirerank](../teirerank) chart for more information. + +After you've deployted the teirerank chart successfully, please run `kubectl get svc` to get the tei service endpoint, i.e. `http://teirerank`. + +To install the reranking-usvc chart, run the following: ```console +cd GenAIInfra/helm-charts/common/reranking-usvc export TEI_RERANKING_ENDPOINT="http://teirerank" -helm install reranking reranking-usvc --set TEI_RERANKING_ENDPOINT=${TEI_RERANKING_ENDPOINT} +helm dependency update +helm install reranking-usvc . --set TEI_RERANKING_ENDPOINT=${TEI_RERANKING_ENDPOINT} +``` + +## (Option2): Installing the chart with dependencies automatically: + +```console +cd GenAIInfra/helm-charts/common/reranking-usvc +helm dependency update +helm install reranking-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/reranking-usvc 8000:8000` to expose the reranking-usvc service for access. + +Open another terminal and run the following command to verify the service if working: + +```console +curl http://localhost:8000/v1/reranking \ + -X POST \ + -d '{"initial_query":"What is Deep Learning?", "retrieved_docs": [{"text":"Deep Learning is not..."}, {"text":"Deep learning is..."}]}' \ + -H 'Content-Type: application/json' ``` ## Values diff --git a/helm-charts/common/reranking-usvc/templates/NOTES.txt b/helm-charts/common/reranking-usvc/templates/NOTES.txt deleted file mode 100644 index 3a3e2ded..00000000 --- a/helm-charts/common/reranking-usvc/templates/NOTES.txt +++ /dev/null @@ -1,7 +0,0 @@ -1. Get the application IP or URL by running these commands: - export reranking_uservice_svc_ip=$(kubectl get svc --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "reranking-usvc.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].spec.clusterIP}") && echo ${reranking_uservice_svc_ip} -2. Use this command to verify tei service: - curl ${reranking_uservice_svc_ip}:{{ .Values.service.port }}/v1/rerankings\ - -X POST \ - -d '{"initial_query":"What is Deep Learning?", "retrieved_docs": [{"text":"Deep Learning is not..."}, {"text":"Deep learning is..."}]}' \ - -H 'Content-Type: application/json' diff --git a/helm-charts/common/reranking-usvc/templates/tests/test-pod.yaml b/helm-charts/common/reranking-usvc/templates/tests/test-pod.yaml new file mode 100644 index 00000000..b9f92e0c --- /dev/null +++ b/helm-charts/common/reranking-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 "reranking-usvc.fullname" . }}-testpod" + labels: + {{- include "reranking-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 "reranking-usvc.fullname" . }}:{{ .Values.service.port }}/v1/reranking -sS --fail-with-body \ + -X POST \ + -d '{"initial_query":"What is Deep Learning?", "retrieved_docs": [{"text":"Deep Learning is not..."}, {"text":"Deep learning is..."}]}' \ + -H 'Content-Type: application/json' + restartPolicy: Never diff --git a/helm-charts/common/reranking-usvc/values.yaml b/helm-charts/common/reranking-usvc/values.yaml index eccda5b0..89c6c83d 100644 --- a/helm-charts/common/reranking-usvc/values.yaml +++ b/helm-charts/common/reranking-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_RERANKING_ENDPOINT: ""