-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathstatefulset.yaml
More file actions
298 lines (298 loc) · 11.8 KB
/
statefulset.yaml
File metadata and controls
298 lines (298 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
{{- $fullName := include "library-chart.fullname" . -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "library-chart.fullname" . }}
labels:
{{- include "library-chart.labels" . | nindent 4 }}
spec:
{{- if not (.Values.autoscaling).enabled }}
{{- if (.Values.global).suspend }}
replicas: 0
{{- else }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- end }}
serviceName: {{ include "library-chart.fullname" . }}
selector:
matchLabels:
{{- include "library-chart.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- if (.Values.git).enabled }}
checksum/git: {{ include (print $.Template.BasePath "/secret-git.yaml") . | sha256sum }}
{{- end }}
{{- if (.Values.s3).enabled }}
checksum/s3: {{ include (print $.Template.BasePath "/secret-s3.yaml") . | sha256sum }}
{{- end }}
{{- if (.Values.vault).enabled }}
checksum/vault: {{ include (print $.Template.BasePath "/secret-vault.yaml") . | sha256sum }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretHive" .))) }}
checksum/hive: {{ include (print $.Template.BasePath "/secret-hive.yaml") . | sha256sum }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretMetaflow" .))) }}
checksum/metaflow: {{ include (print $.Template.BasePath "/secret-metaflow.yaml") . | sha256sum }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretMLFlow" .))) }}
checksum/mlflow: {{ include (print $.Template.BasePath "/secret-mlflow.yaml") . | sha256sum }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretChromaDB" .))) }}
checksum/chromadb: {{ include (print $.Template.BasePath "/secret-chromadb.yaml") . | sha256sum }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretMilvus" .))) }}
checksum/milvus: {{ include (print $.Template.BasePath "/secret-milvus.yaml") . | sha256sum }}
{{- end }}
{{- if (include "library-chart.repository.enabled" .) }}
checksum/repository: {{ include (print $.Template.BasePath "/configmap-repository.yaml") . | sha256sum }}
{{- end }}
{{- if and .Values.certificates .Values.certificates.cacerts }}
checksum/cacerts: {{ .Values.certificates.cacerts | sha256sum }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "library-chart.selectorLabels" . | nindent 8 }}
spec:
volumes:
- name: config-files
emptyDir: {}
- name: home
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "library-chart.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
- name: dshm
emptyDir:
medium: Memory
sizeLimit: 10Gi
{{- if (.Values.proxy).enabled }}
- name: secret-proxy
secret:
secretName: {{ include "library-chart.secretNameProxy" . }}
{{- end }}
{{- if .Values.discovery.hive }}
- name: secret-hive
secret:
secretName: {{ include "library-chart.secretNameHive" . }}
{{- end }}
{{- if .Values.discovery.metaflow }}
- name: secret-metaflow
secret:
secretName: {{ include "library-chart.secretNameMetaflow" . }}
{{- end }}
{{- if and .Values.certificates .Values.certificates.cacerts }}
- name: cacerts
secret:
secretName: {{ include "library-chart.secretNameCacerts" . }}
{{- end }}
{{- if (.Values.userPreferences.aiAssistant).enabled }}
- name: secret-assistant
secret:
secretName: {{ include "library-chart.secretNameAssistant" . }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "library-chart.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: make-secrets-writable
image: inseefrlab/onyxia-base:latest
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
echo 'initContainer make-secrets-writable is started';
{{ if (.Values.userPreferences.aiAssistant).enabled }}
mkdir /dest/continue
cp /src/continue/config.yaml /dest/continue/config.yaml
{{- end }}
{{- if .Values.discovery.hive }}
mkdir /dest/hive;
cp /src/hive/hive-site.xml /dest/hive/hive-site.xml;
{{- end }}
{{- if .Values.discovery.metaflow }}
mkdir /dest/metaflow;
cp /src/metaflow/config.json /dest/metaflow/config.json;
{{- end }}
{{- if and .Values.certificates .Values.certificates.cacerts }}
mkdir /dest/cacerts;
{{- if regexMatch "^https?://" .Values.certificates.cacerts }}
curl -s $(cat /cacerts/ca-certs.url) -o /tmp/ca.pem
{{- else }}
cp /cacerts/ca.pem /tmp/ca.pem
{{- end }}
awk 'BEGIN {c=0;} /BEGIN CERT/{c++} { print > "/dest/cacerts/cert." c ".crt"}' < /tmp/ca.pem;
{{- end }}
volumeMounts:
{{- if (.Values.userPreferences.aiAssistant).enabled }}
- name: secret-assistant
mountPath: /src/continue
{{- end }}
- name: config-files
mountPath: /dest
{{- if and .Values.certificates .Values.certificates.cacerts }}
- name: cacerts
mountPath: /cacerts
{{- end }}
{{- if .Values.discovery.hive }}
- name: secret-hive
mountPath: /src/hive
{{- end }}
{{- if .Values.discovery.metaflow }}
- name : secret-metaflow
mountPath: /src/metaflow
{{- end }}
resources:
limits:
cpu: 50m
memory: 50Mi
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- if .Values.service.image.custom.enabled }}
image: "{{ .Values.service.image.custom.version }}"
{{- else }}
image: "{{ .Values.service.image.version }}"
{{- end }}
command: ["/bin/sh","-c"]
args: ["{{ .Values.init.standardInitPath }} /usr/bin/code-server --host 0.0.0.0 /home/{{ .Values.environment.user }}/work"]
imagePullPolicy: {{ .Values.service.image.pullPolicy }}
env:
{{- if .Values.init.regionInit }}
- name: REGION_INIT_SCRIPT
value: {{ .Values.init.regionInit }}
{{- end }}
{{- if .Values.init.regionInitCheckSum }}
- name: REGION_INIT_SCRIPT_CHECKSUM
value: {{ .Values.init.regionInitCheckSum }}
{{- end }}
{{- if .Values.init.personalInit }}
- name: PERSONAL_INIT_SCRIPT
value: {{ .Values.init.personalInit }}
{{- end }}
{{- if .Values.init.personalInitArgs }}
- name: PERSONAL_INIT_ARGS
value: {{ .Values.init.personalInitArgs }}
{{- end }}
- name: PROJECT_USER
value: {{ .Values.environment.user }}
- name: PROJECT_GROUP
value: {{ .Values.environment.group }}
- name: ROOT_PROJECT_DIRECTORY
value: /home/{{ .Values.environment.user }}/work
{{- if .Values.userPreferences.darkMode }}
- name: DARK_MODE
value: "true"
{{- end }}
{{- if .Values.service.customPythonEnv }}
- name: CUSTOM_PYTHON_ENV
value: "true"
{{- end }}
envFrom:
- secretRef:
name : {{ include "library-chart.secretNameToken" . }}
{{- if (.Values.git).enabled }}
- secretRef:
name: {{ include "library-chart.secretNameGit" . }}
{{- end }}
{{- if (.Values.s3).enabled }}
- secretRef:
name: {{ include "library-chart.secretNameS3" . }}
{{- end }}
{{- if (.Values.vault).enabled }}
- secretRef:
name: {{ include "library-chart.secretNameVault" . }}
{{- end }}
{{- if (.Values.proxy).enabled }}
- secretRef:
name: {{ include "library-chart.secretNameProxy" . }}
{{- end }}
{{- if (include "library-chart.repository.enabled" .) }}
- configMapRef:
name: {{ include "library-chart.configMapNameRepository" . }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretMLFlow" .))) }}
- secretRef:
name: {{ include "library-chart.secretNameMLFlow" . }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretChromaDB" .))) }}
- secretRef:
name: {{ include "library-chart.secretNameChromaDB" . }}
{{- end }}
{{- if not (empty (trim (include "library-chart.secretMilvus" .))) }}
- secretRef:
name: {{ include "library-chart.secretNameMilvus" . }}
{{- end }}
{{- if .Values.extraEnvVars }}
- secretRef:
name: {{ include "library-chart.secretNameExtraEnv" . }}
{{- end }}
livenessProbe:
httpGet:
path: /
port: {{ .Values.networking.service.port }}
timeoutSeconds: 2
failureThreshold: 6
readinessProbe:
httpGet:
path: /
port: {{ .Values.networking.service.port }}
{{- if hasKey .Values "startupProbe" }}
startupProbe:
httpGet:
path: /
port: {{ .Values.networking.service.port }}
{{- toYaml .Values.startupProbe | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /home/{{ .Values.environment.user }}/work
subPath: work
name: home
- mountPath: /dev/shm
name: dshm
{{ if (.Values.userPreferences.aiAssistant).enabled }}
- mountPath: /home/{{ .Values.environment.user }}/.continue
subPath: continue
name: config-files
{{- end }}
{{- if (.Values.discovery).hive }}
- name: config-files
mountPath: /usr/local/lib/hive/conf/hive-site.xml
subPath: hive/hive-site.xml
{{- end }}
{{- if (.Values.discovery).metaflow }}
- name: config-files
mountPath: /home/{{ .Values.environment.user }}/.metaflowconfig
subPath: metaflow
{{- end }}
{{- if (.Values.certificates).pathToCaBundle }}
- name: config-files
mountPath: {{ .Values.certificates.pathToCaBundle }}
subPath: cacerts
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}