Skip to content

Commit

Permalink
ui: add helm chart/manifests for conversational UI (#251)
Browse files Browse the repository at this point in the history
* ui: add helm chart/manifests for conversational UI

Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>

* ui: add conventional ui in helm/manifests

Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>

---------

Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>
  • Loading branch information
Ruoyu-y authored Aug 6, 2024
1 parent d39b315 commit 9dbe550
Show file tree
Hide file tree
Showing 9 changed files with 409 additions and 0 deletions.
23 changes: 23 additions & 0 deletions helm-charts/common/ui/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions helm-charts/common/ui/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v2
name: ui
description: A Helm chart to the UI for chatQnA workload
type: application
version: 0.8.0
appVersion: "1.0.0"
62 changes: 62 additions & 0 deletions helm-charts/common/ui/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ui.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ui.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ui.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ui.labels" -}}
helm.sh/chart: {{ include "ui.chart" . }}
{{ include "ui.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ui.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ui.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "ui.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ui.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions helm-charts/common/ui/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "ui.fullname" . }}-config
labels:
{{- include "ui.labels" . | nindent 4 }}
data:
http_proxy: {{ .Values.global.http_proxy | quote }}
https_proxy: {{ .Values.global.https_proxy | quote }}
no_proxy: {{ .Values.global.no_proxy | quote }}
BACKEND_SERVICE_ENDPOINT: {{ .Values.BACKEND_SERVICE_ENDPOINT | quote }}
DATAPREP_SERVICE_ENDPOINT: {{ .Values.DATAPREP_SERVICE_ENDPOINT | quote }}
DATAPREP_GET_FILE_ENDPOINT: {{ .Values.DATAPREP_GET_FILE_ENDPOINT | quote }}
CHAT_BASE_URL: {{ .Values.BACKEND_SERVICE_ENDPOINT | quote }}
UPLOAD_FILE_BASE_URL: {{ .Values.DATAPREP_SERVICE_ENDPOINT | quote }}
GET_FILE: {{ .Values.DATAPREP_GET_FILE_ENDPOINT | quote }}
DELETE_FILE: {{ .Values.DATAPREP_DELETE_FILE_ENDPOINT | quote }}
67 changes: 67 additions & 0 deletions helm-charts/common/ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ui.fullname" . }}
labels:
{{- include "ui.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "ui.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ui.labels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
envFrom:
- configMapRef:
name: {{ include "ui.fullname" . }}-config
{{- if .Values.global.extraEnvConfig }}
- configMapRef:
name: {{ .Values.global.extraEnvConfig }}
optional: true
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: ui
containerPort: {{ .Values.containerPort }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /tmp
name: tmp
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
18 changes: 18 additions & 0 deletions helm-charts/common/ui/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Service
metadata:
name: {{ include "ui.fullname" . }}
labels:
{{- include "ui.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: ui
protocol: TCP
name: ui
selector:
{{- include "ui.selectorLabels" . | nindent 4 }}
23 changes: 23 additions & 0 deletions helm-charts/common/ui/templates/tests/test-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Pod
metadata:
name: "{{ include "ui.fullname" . }}-testpod"
labels:
{{- include "ui.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 "ui.fullname" . }}:{{ .Values.service.port }} -sS --fail-with-body \
-X GET
restartPolicy: Never
80 changes: 80 additions & 0 deletions helm-charts/common/ui/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# Default values for conversational-ui.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: opea/chatqna-conversation-ui:latest
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
# tag: ""

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# Currently comment the securityContext settings
# as the inappropriate settings within Conversational UI (need root privilege)
# issue: https://github.com/opea-project/GenAIExamples/issues/517
#readOnlyRootFilesystem: true
#allowPrivilegeEscalation: false
#runAsNonRoot: true
#runAsUser: 1000
#capabilities:
# drop:
# - ALL
#seccompProfile:
# type: RuntimeDefault

# internal container port
# conventional ui container port: 5173, conversational ui container port: 80
containerPort: 80

service:
type: ClusterIP
port: 5174

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

# chatQnA Mega service URL, e.g. http://<service-name>:<port>
BACKEND_SERVICE_ENDPOINT: ""

# data preparation service URL, http://<service-name>:<port>
DATAPREP_SERVICE_ENDPOINT: ""

# data preparation get file service URL, http://<service-name>:<port>
DATAPREP_GET_FILE_ENDPOINT: ""

# data preparation delete file service URL, http://<service-name>:<port>
DATAPREP_DELETE_FILE_ENDPOINT: ""

global:
http_proxy: ""
https_proxy: ""
no_proxy: ""
Loading

0 comments on commit 9dbe550

Please sign in to comment.