-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstatefulset.yaml
213 lines (213 loc) · 8.09 KB
/
statefulset.yaml
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
{{- $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 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 and .Values.discovery.mlflow (not (empty (trim (include "library-chart.secretMLFlow" .)))) }}
checksum/mlflow: {{ include (print $.Template.BasePath "/secret-mlflow.yaml") . | sha256sum }}
{{- end }}
{{- if (include "library-chart.repository.enabled" .) }}
checksum/repository: {{ include (print $.Template.BasePath "/configmap-repository.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 }}
{{- 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.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 }}
{{- 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
command:
- sh
- -c
- |
echo 'initContainer make-secrets-writable is started';
{{- 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 }}
volumeMounts:
- name: config-files
mountPath: /dest
{{- 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 }}
envFrom:
- secretRef:
name : {{ include "library-chart.secretNameToken" . }}
{{- if .Values.s3.enabled }}
- secretRef:
name: {{ include "library-chart.secretNameS3" . }}
{{- end }}
{{- if .Values.vault.enabled }}
- secretRef:
name: {{ include "library-chart.secretNameVault" . }}
{{- end }}
{{- if .Values.git.enabled }}
- secretRef:
name: {{ include "library-chart.secretNameGit" . }}
{{- 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 }}
livenessProbe:
httpGet:
path: /
port: {{ .Values.networking.service.port }}
readinessProbe:
httpGet:
path: /
port: {{ .Values.networking.service.port }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /home/{{ .Values.environment.user}}/work
subPath: work
name: home
- mountPath: /dev/shm
name: dshm
{{- if .Values.discovery.hive }}
- name: config-files
mountPath: /opt/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 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}