Skip to content

Commit

Permalink
Add helm test for chart reranking-usvc
Browse files Browse the repository at this point in the history
- Add helm test for chart

- Update the chart README

- Add flag autodependency.enabled=true to automatically install dependency charts

Signed-off-by: Lianhao Lu <[email protected]>
  • Loading branch information
lianhao authored and leslieluyu committed Jul 18, 2024
1 parent f4f3ea0 commit 3972089
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 11 deletions.
5 changes: 5 additions & 0 deletions helm-charts/common/reranking-usvc/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
37 changes: 33 additions & 4 deletions helm-charts/common/reranking-usvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions helm-charts/common/reranking-usvc/templates/NOTES.txt

This file was deleted.

25 changes: 25 additions & 0 deletions helm-charts/common/reranking-usvc/templates/tests/test-pod.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions helm-charts/common/reranking-usvc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down

0 comments on commit 3972089

Please sign in to comment.