Newer
Older
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
{{- $fullName := include "library-chart.fullname" . -}}
{{- $volumeName := printf "%s-%s" $fullName "data" | trunc 63 | trimSuffix "-" -}}
{{- $initContainerName := printf "%s-%s" $fullName "init-data" | trunc 63 | trimSuffix "-" -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "library-chart.fullname" . }}
labels:
{{- include "library-chart.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
serviceName: {{ include "library-chart.fullname" . }}
selector:
matchLabels:
{{- include "library-chart.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "library-chart.selectorLabels" . | nindent 8 }}
spec:
volumes:
- name: home
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "library-chart.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
- name: {{$volumeName}}
emptyDir: {}
{{- if .Values.discovery.hive }}
- name: hive-config
configMap:
name: {{ include "library-chart.configMapNameHive" . }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "library-chart.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
subdomain: {{ include "library-chart.fullname" . }}
hostname: jupyter
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: ["/data/{{ .Values.init.filename}} jupyter lab --no-browser --ip '0.0.0.0' --LabApp.token='$(PASSWORD)'"]
imagePullPolicy: {{ .Values.service.image.pullPolicy }}
env:
- name: KUBERNETES_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: IMAGE_NAME
{{- if .Values.service.image.custom.enabled }}
value: "{{ .Values.service.image.custom.version }}"
{{- else }}
value: "{{ .Values.service.image.version }}"
{{- end }}
- name: NB_USER
value: {{ .Values.environment.user }}
- name: PASSWORD
value: {{ .Values.security.password }}
- 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.init.personalInit }}
- name: PERSONAL_INIT_SCRIPT
value: {{ .Values.init.personalInit }}
{{- end }}
{{- if .Values.init.personalInitArgs }}
- name: PERSONAL_INIT_ARGS
value: {{ .Values.init.personalInitArgs }}
{{- end }}
{{- if .Values.environment.root }}
- name: GRANT_SUDO
value: "yes"
{{- end }}
envFrom:
{{- if .Values.s3.enabled }}
- configMapRef:
name: {{ include "library-chart.configMapNameS3" . }}
{{- end }}
{{- if .Values.vault.enabled }}
- configMapRef:
name: {{ include "library-chart.configMapNameVault" . }}
{{- end }}
{{- if .Values.git.enabled }}
- configMapRef:
name: {{ include "library-chart.configMapNameGit" . }}
{{- end }}
{{- if not (empty (trim (include "library-chart.configMapMLFlow" .)))}}
- configMapRef:
name: {{ include "library-chart.configMapNameMLFlow" . }}
{{- end }}
ports:
- name: http
containerPort: 8888
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
startupProbe:
httpGet:
path: /
port: http
{{- toYaml .Values.startupProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /data
name: {{$volumeName}}
- mountPath: /home/{{ .Values.environment.user}}/work
name: home
{{- if .Values.discovery.hive }}
- name: hive-config
mountPath: /opt/hive/conf/hive-site.xml
subPath: hive-site.xml
{{- end }}
initContainers:
- name: standard-init
image: "busybox"
imagePullPolicy: "IfNotPresent"
command: ["/bin/sh","-c"]
args: ["wget -O /data/{{ .Values.init.filename}} {{ .Values.init.standardInit}} && chmod +x /data/{{ .Values.init.filename}}"]
volumeMounts:
- mountPath: /data
name: {{$volumeName}}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}