Skip to content

Commit 8edefcf

Browse files
authored
PILOT-7109: Chat - Create helm chart for now openai service (#180)
* Create helmchart. * Updated helmchart. * Packaged helmchart * Renamed chart * Moved some variables. * Re-package
1 parent 5242f8c commit 8edefcf

11 files changed

+808
-431
lines changed

ai-chat-service-0.1.0.tgz

2.73 KB
Binary file not shown.

ai-chat-service/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

ai-chat-service/Chart.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: ai-chat-service
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "0.1.0"
+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "ai-chat-service.fullname" . }}
5+
labels:
6+
{{- include "ai-chat-service.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
{{- if .Values.updateStrategy }}
12+
strategy:
13+
{{- toYaml .Values.updateStrategy | nindent 4 }}
14+
{{- end }}
15+
selector:
16+
matchLabels:
17+
{{- include "ai-chat-service.selectorLabels" . | nindent 6 }}
18+
template:
19+
metadata:
20+
{{- with .Values.podAnnotations }}
21+
annotations:
22+
{{- toYaml . | nindent 8 }}
23+
{{- end }}
24+
labels:
25+
{{- include "ai-chat-service.selectorLabels" . | nindent 8 }}
26+
spec:
27+
{{- with .Values.imagePullSecrets }}
28+
imagePullSecrets:
29+
{{- toYaml . | nindent 8 }}
30+
{{- end }}
31+
{{- if .Values.serviceAccount.create }}
32+
serviceAccountName: {{ .Values.serviceAccount.name }}
33+
{{- end }}
34+
containers:
35+
- name: {{ .Chart.Name }}
36+
image: "{{ .Values.image.repository }}:ai-chat-{{ .Values.image.tag | default .Chart.AppVersion }}"
37+
imagePullPolicy: {{ .Values.image.pullPolicy }}
38+
{{- if .Values.command }}
39+
{{- with .Values.command }}
40+
command:
41+
{{- toYaml . | nindent 12 }}
42+
{{- end }}
43+
{{- end }}
44+
{{- if .Values.args }}
45+
{{- with .Values.args }}
46+
args:
47+
{{- toYaml . | nindent 12 }}
48+
{{- end }}
49+
{{- end }}
50+
ports:
51+
- containerPort: {{ .Values.container.port }}
52+
env:
53+
###################### START OF APP CONFIG #############################
54+
- name: HOST
55+
value: {{ .Values.appConfig.HOST | quote }}
56+
- name: PORT
57+
value: {{ .Values.appConfig.PORT | quote }}
58+
- name: WORKERS
59+
value: {{ .Values.appConfig.WORKERS | quote }}
60+
- name: RELOAD
61+
value: {{ .Values.appConfig.RELOAD | quote }}
62+
- name: LOGGING_LEVEL
63+
value: {{ .Values.appConfig.LOGGING_LEVEL | quote }}
64+
- name: LOGGING_FORMAT
65+
value: {{ .Values.appConfig.LOGGING_FORMAT | quote }}
66+
- name: API_VERSION
67+
value: {{ .Values.appConfig.API_VERSION | quote }}
68+
- name: SYSTEM_PROMPT
69+
value: {{ .Values.appConfig.SYSTEM_PROMPT | quote }}
70+
- name: AZURE_ENDPOINT_URL
71+
value: {{ .Values.appConfig.AZURE_ENDPOINT_URL | quote }}
72+
- name: AZURE_SEARCH_ENDPOINT
73+
value: {{ .Values.appConfig.AZURE_SEARCH_ENDPOINT | quote }}
74+
- name: AZURE_SEARCH_INDEX
75+
value: {{ .Values.appConfig.AZURE_SEARCH_INDEX | quote }}
76+
- name: AZURE_DEPLOYMENT
77+
value: {{ .Values.appConfig.AZURE_DEPLOYMENT | quote }}
78+
- name: CHAT_HISTORY_LEN
79+
value: {{ .Values.appConfig.CHAT_HISTORY_LEN | quote }}
80+
- name: SERVICE_CLIENT_TIMEOUT
81+
value: {{ .Values.appConfig.SERVICE_CLIENT_TIMEOUT | quote }}
82+
83+
# Microservices connections
84+
#if tenant id is not set
85+
{{- if not .Values.appConfig.tenant_id }}
86+
- name: AUTH_SERVICE
87+
value: "http://auth.utility:5061"
88+
{{- else }}
89+
- name: AUTH_SERVICE
90+
value: "http://auth.{{ .Values.appConfig.tenant_id }}-utility:5061"
91+
{{- end}}
92+
93+
# redis
94+
{{- if not .Values.appConfig.tenant_id }}
95+
- name: REDIS_HOST
96+
value: {{ .Values.appConfig.REDIS_HOST | quote }}
97+
{{- else }}
98+
- name: REDIS_HOST
99+
value: "redis-master.{{ .Values.appConfig.tenant_id }}-redis"
100+
{{- end }}
101+
- name: REDIS_PORT
102+
value: {{ .Values.appConfig.REDIS_PORT | quote }}
103+
104+
# open telemetry
105+
- name: OPEN_TELEMETRY_ENABLED
106+
value: {{ .Values.appConfig.OPEN_TELEMETRY_ENABLED | quote }}
107+
- name: OPEN_TELEMETRY_HOST
108+
value: {{ .Values.appConfig.OPEN_TELEMETRY_HOST | quote }}
109+
- name: OPEN_TELEMETRY_PORT
110+
value: {{ .Values.appConfig.OPEN_TELEMETRY_PORT | quote }}
111+
###################### END OF APP CONFIG #############################
112+
{{- if .Values.extraEnv }}
113+
{{- range $key, $value := .Values.extraEnv }}
114+
- name: {{ $key }}
115+
value: {{ $value | quote }}
116+
{{- end }}
117+
{{- end }}
118+
{{- with .Values.extraEnvYaml }}
119+
{{- toYaml . | nindent 10 }}
120+
{{- end }}
121+
resources:
122+
{{- toYaml .Values.resources | nindent 12 }}
123+
{{- if .Values.readinessProbe }}
124+
readinessProbe:
125+
{{- toYaml .Values.readinessProbe | nindent 12 }}
126+
{{- end }}
127+
{{- if .Values.livenessProbe }}
128+
livenessProbe:
129+
{{- toYaml .Values.livenessProbe | nindent 12 }}
130+
{{- end }}
131+
{{- with .Values.nodeSelector }}
132+
nodeSelector:
133+
{{- toYaml . | nindent 8 }}
134+
{{- end }}
135+
{{- with .Values.affinity }}
136+
affinity:
137+
{{- toYaml . | nindent 8 }}
138+
{{- end }}
139+
{{- with .Values.tolerations }}
140+
tolerations:
141+
{{- toYaml . | nindent 8 }}
142+
{{- end }}
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "ai-chat-service.fullname" . -}}
3+
{{- $svcPort := .Values.container.port -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
14+
apiVersion: extensions/v1beta1
15+
{{- end }}
16+
kind: Ingress
17+
metadata:
18+
name: {{ $fullName }}
19+
labels:
20+
{{- include "ai-chat-service.labels" . | nindent 4 }}
21+
{{- with .Values.ingress.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingress.className }}
28+
{{- end }}
29+
{{- if .Values.ingress.tls }}
30+
tls:
31+
{{- range .Values.ingress.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.ingress.hosts }}
41+
- host: {{ .host | quote }}
42+
http:
43+
paths:
44+
{{- range .paths }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
49+
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
number: {{ $svcPort }}
55+
{{- else }}
56+
serviceName: {{ $fullName }}
57+
servicePort: {{ $svcPort }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "ai-chat-service.fullname" . }}
5+
labels:
6+
{{- include "ai-chat-service.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: {{ .Values.service.targetPort }}
12+
protocol: TCP
13+
name: {{ include "ai-chat-service.fullname" . }}
14+
selector:
15+
{{- include "ai-chat-service.selectorLabels" . | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
{{- if .Values.imagePullSecrets }}
4+
imagePullSecrets:
5+
{{- range $key, $secret := .Values.imagePullSecrets }}
6+
- name: {{ $secret.name }}
7+
{{- end }}
8+
{{- end }}
9+
kind: ServiceAccount
10+
metadata:
11+
name: {{ include "ai-chat-service.serviceAccountName" . }}
12+
labels:
13+
{{- include "ai-chat-service.labels" . | nindent 4 }}
14+
{{- with .Values.serviceAccount.annotations }}
15+
annotations:
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
{{- end }}
19+
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: "{{ include "ai-chat-service.fullname" . }}-test-connection"
5+
labels:
6+
{{- include "ai-chat-service.labels" . | nindent 4 }}
7+
annotations:
8+
"helm.sh/hook": test
9+
spec:
10+
containers:
11+
- name: wget
12+
image: busybox
13+
command: ['wget']
14+
args: ['{{ include "ai-chat-service.fullname" . }}:{{ .Values.service.port }}']
15+
restartPolicy: Never

ai-chat-service/values.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
replicaCount: 1
2+
3+
image:
4+
repository: ai-chat
5+
tag: latest
6+
pullPolicy: Always
7+
8+
imagePullSecrets: []
9+
10+
service:
11+
type: ClusterIP
12+
port: 80
13+
14+
serviceAccount:
15+
# Specifies whether a service account should be created
16+
create: false
17+
name:
18+
19+
appConfig:
20+
HOST: "0.0.0.0"
21+
PORT: 5071
22+
WORKERS: 1
23+
RELOAD: false
24+
LOGGING_LEVEL: "DEBUG"
25+
LOGGING_FORMAT: "json"
26+
API_VERSION: ""
27+
SYSTEM_PROMPT: ""
28+
AZURE_API_KEY: ""
29+
AZURE_ENDPOINT_URL: ""
30+
AZURE_SEARCH_ENDPOINT: ""
31+
AZURE_SEARCH_KEY: ""
32+
AZURE_SEARCH_INDEX: ""
33+
AZURE_DEPLOYMENT: ""
34+
AUTH_SERVICE: "http://auth:5061/v1/"
35+
REDIS_HOST: "127.0.0.1"
36+
REDIS_PORT: 6379
37+
REDIS_PASSWORD: "password"
38+
REDIS_USERNAME: "user"
39+
CHAT_HISTORY_LEN: 20
40+
SERVICE_CLIENT_TIMEOUT: 1000
41+
OPEN_TELEMETRY_ENABLED: false
42+
OPEN_TELEMETRY_HOST: ""
43+
OPEN_TELEMETRY_PORT: ""
44+
45+
podAnnotations: {}
46+
47+
ingress:
48+
enabled: false
49+
50+
resources: {}
51+
52+
autoscaling:
53+
enabled: false
54+
55+
nodeSelector: {}
56+
57+
tolerations: []
58+
59+
affinity: {}
60+
61+
readinessProbe: {}
62+
63+
updateStrategy: {}
64+
65+
extraEnv: {}
66+
67+
extraEnvYaml: {}

docs/ai-chat-0.1.0.tgz

2.76 KB
Binary file not shown.

0 commit comments

Comments
 (0)