Skip to content

Commit

Permalink
e2e helm chart: Add ui for codegen/codetrans/docsum
Browse files Browse the repository at this point in the history
Signed-off-by: Lianhao Lu <[email protected]>
  • Loading branch information
lianhao committed Sep 10, 2024
1 parent 56d7d5d commit 542f2c6
Show file tree
Hide file tree
Showing 32 changed files with 439 additions and 65 deletions.
5 changes: 3 additions & 2 deletions helm-charts/chatqna/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ dependencies:
- name: data-prep
version: 1.0.0
repository: "file://../common/data-prep"
- name: chatqna-ui
- name: ui
alias: chatqna-ui
version: 1.0.0
repository: "file://../common/chatqna-ui"
repository: "file://../common/ui"
version: 1.0.0
appVersion: "v1.0"
4 changes: 2 additions & 2 deletions helm-charts/chatqna/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ curl http://localhost:8888/v1/chatqna \

### Verify the workload through UI

The UI has already been installed via the Helm chart. To access it, use the external IP of your Kubernetes cluster along with the NGINX port. You can find the NGINX port using the following command:
The UI has already been installed via the Helm chart. To access it, use the external IP of one your Kubernetes node along with the NGINX port. You can find the NGINX port using the following command:

```bash
export port=$(kubectl get service chatqna-nginx --output='jsonpath={.spec.ports[0].nodePort}')
echo $port
```

Open a browser to access `http://<k8s-cluster-ip-address>:${port}` to play with the ChatQnA workload.
Open a browser to access `http://<k8s-node-ip-address>:${port}` to play with the ChatQnA workload.

## Values

Expand Down
20 changes: 4 additions & 16 deletions helm-charts/chatqna/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ metadata:
name: {{ include "chatqna.fullname" . }}
labels:
{{- include "chatqna.labels" . | nindent 4 }}
app: {{ include "chatqna.fullname" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "chatqna.selectorLabels" . | nindent 6 }}
app: {{ include "chatqna.fullname" . }}
template:
metadata:
{{- with .Values.podAnnotations }}
Expand All @@ -20,6 +22,7 @@ spec:
{{- end }}
labels:
{{- include "chatqna.selectorLabels" . | nindent 8 }}
app: {{ include "chatqna.fullname" . }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down Expand Up @@ -51,22 +54,6 @@ spec:
- name: chatqna
containerPort: {{ .Values.port }}
protocol: TCP
# startupProbe:
# httpGet:
# host: {{ .Release.Name }}-llm-uservice
# port: {{ index .Values "llm-uservice" "service" "port" }}
# path: /
# initialDelaySeconds: 5
# periodSeconds: 5
# failureThreshold: 120
# livenessProbe:
# httpGet:
# path: /
# port: {{ .Values.port }}
# readinessProbe:
# httpGet:
# path: /
# port: {{ .Values.port }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
Expand All @@ -92,4 +79,5 @@ spec:
labelSelector:
matchLabels:
{{- include "chatqna.selectorLabels" . | nindent 14 }}
app: {{ include "chatqna.fullname" . }}
{{- end }}
24 changes: 21 additions & 3 deletions helm-charts/chatqna/templates/nginx-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,29 @@ data:
kind: ConfigMap
metadata:
name: nginx-default-config
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
imagePullPolicy: IfNotPresent
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: nginx
volumeMounts:
- mountPath: /etc/nginx/conf.d
Expand All @@ -82,8 +87,20 @@ spec:
volumes:
- configMap:
defaultMode: 420
name: nginx-default-config
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
Expand All @@ -95,5 +112,6 @@ spec:
protocol: TCP
targetPort: 80
selector:
{{- include "chatqna.selectorLabels" . | nindent 4 }}
app: {{ include "chatqna.fullname" . }}-nginx
type: NodePort
1 change: 1 addition & 0 deletions helm-charts/chatqna/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ spec:
name: chatqna
selector:
{{- include "chatqna.selectorLabels" . | nindent 4 }}
app: {{ include "chatqna.fullname" . }}
4 changes: 4 additions & 0 deletions helm-charts/codegen/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ dependencies:
- name: llm-uservice
version: 1.0.0
repository: "file://../common/llm-uservice"
- name: ui
version: 1.0.0
repository: "file://../common/ui"
alias: codegen-ui
version: 1.0.0
appVersion: "v1.0"
15 changes: 15 additions & 0 deletions helm-charts/codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ helm install codegen codegen --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --

To verify the installation, run the command `kubectl get pod` to make sure all pods are running.

Curl command and UI are the two options that can be leveraged to verify the result.

### Verify the workload through curl command

Then run the command `kubectl port-forward svc/codegen 7778:7778` to expose the service for access.

Open another terminal and run the following command to verify the service if working:
Expand All @@ -41,6 +45,17 @@ curl http://localhost:7778/v1/codegen \
-d '{"messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."}'
```

### Verify the workload through UI

The UI has already been installed via the Helm chart. To access it, use the external IP of one your Kubernetes node along with the NGINX port. You can find the NGINX port using the following command:

```bash
export port=$(kubectl get service codegen-nginx --output='jsonpath={.spec.ports[0].nodePort}')
echo $port
```

Open a browser to access `http://<k8s-node-ip-address>:${port}` to play with the ChatQnA workload.

## Values

| Key | Type | Default | Description |
Expand Down
20 changes: 4 additions & 16 deletions helm-charts/codegen/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ metadata:
name: {{ include "codegen.fullname" . }}
labels:
{{- include "codegen.labels" . | nindent 4 }}
app: {{ include "codegen.fullname" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "codegen.selectorLabels" . | nindent 6 }}
app: {{ include "codegen.fullname" . }}
template:
metadata:
{{- with .Values.podAnnotations }}
Expand All @@ -20,6 +22,7 @@ spec:
{{- end }}
labels:
{{- include "codegen.selectorLabels" . | nindent 8 }}
app: {{ include "codegen.fullname" . }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand All @@ -45,22 +48,6 @@ spec:
- name: codegen
containerPort: {{ .Values.port }}
protocol: TCP
# startupProbe:
# httpGet:
# host: {{ .Release.Name }}-llm-uservice
# port: {{ index .Values "llm-uservice" "service" "port" }}
# path: /
# initialDelaySeconds: 5
# periodSeconds: 5
# failureThreshold: 120
# livenessProbe:
# httpGet:
# path: /
# port: {{ .Values.port }}
# readinessProbe:
# httpGet:
# path: /
# port: {{ .Values.port }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
Expand All @@ -86,4 +73,5 @@ spec:
labelSelector:
matchLabels:
{{- include "codegen.selectorLabels" . | nindent 14 }}
app: {{ include "codegen.fullname" . }}
{{- end }}
93 changes: 93 additions & 0 deletions helm-charts/codegen/templates/nginx-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
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;
}
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;
}
}
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
imagePullPolicy: {{ .Values.image.pullPolicy }}
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: NodePort
1 change: 1 addition & 0 deletions helm-charts/codegen/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ spec:
name: codegen
selector:
{{- include "codegen.selectorLabels" . | nindent 4 }}
app: {{ include "codegen.fullname" . }}
7 changes: 7 additions & 0 deletions helm-charts/codegen/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ affinity: {}
tgi:
LLM_MODEL_ID: meta-llama/CodeLlama-7b-hf

codegen-ui:
image:
repository: opea/codegen-ui
tag: "latest"
BACKEND_SERVICE_ENDPOINT: "/v1/codegen"
containerPort: 5173

global:
http_proxy: ""
https_proxy: ""
Expand Down
4 changes: 4 additions & 0 deletions helm-charts/codetrans/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ dependencies:
- name: llm-uservice
version: 1.0.0
repository: "file://../common/llm-uservice"
- name: ui
version: 1.0.0
repository: "file://../common/ui"
alias: codetrans-ui
version: 1.0.0
appVersion: "v1.0"
15 changes: 15 additions & 0 deletions helm-charts/codetrans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ helm install codetrans codetrans --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN

To verify the installation, run the command `kubectl get pod` to make sure all pods are running.

Curl command and UI are the two options that can be leveraged to verify the result.

### Verify the workload through curl command

Then run the command `kubectl port-forward svc/codetrans 7777:7777` to expose the CodeTrans service for access.

Open another terminal and run the following command to verify the service if working:
Expand All @@ -34,6 +38,17 @@ curl http://localhost:7777/v1/codetrans \
-d '{"language_from": "Golang","language_to": "Python","source_code": "package main\n\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"Hello, World!\");\n}"}'
```

### Verify the workload through UI

The UI has already been installed via the Helm chart. To access it, use the external IP of one your Kubernetes node along with the NGINX port. You can find the NGINX port using the following command:

```bash
export port=$(kubectl get service codetrans-nginx --output='jsonpath={.spec.ports[0].nodePort}')
echo $port
```

Open a browser to access `http://<k8s-node-ip-address>:${port}` to play with the ChatQnA workload.

## Values

| Key | Type | Default | Description |
Expand Down
Loading

0 comments on commit 542f2c6

Please sign in to comment.