-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathjupyterhub.yaml
executable file
·302 lines (295 loc) · 9.46 KB
/
jupyterhub.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
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
299
300
301
302
hub:
db:
pvc:
storage: 50Gi
storageClassName: gp3
authenticatePrometheus: false
command: ["sh", "-c", "pip install boto3 && jupyterhub --config /usr/local/etc/jupyterhub/jupyterhub_config.py"]
config:
GitHubOAuthenticator:
client_id: "${client_id}"
client_secret: "${client_secret}"
oauth_callback_url: "https://${jupyterhub_domain}/hub/oauth_callback"
scope:
- read:user
- read:gist
- user:email
cull:
enabled: true
timeout: 3600
every: 300
proxy:
https:
enabled: true
type: offload
hosts:
- "${jupyterhub_domain}"
service:
annotations:
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: ${ssl_cert_arn}
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "3600"
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
service.beta.kubernetes.io/aws-load-balancer-type: external
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: 'true'
service.beta.kubernetes.io/aws-load-balancer-ip-address-type: ipv4
singleuser:
profileList:
- display_name: "Tiny. Useful for many quick things"
description: "0.5 CPU / 1 GB"
profile_options:
image:
display_name: "Image"
choices:
standard:
display_name: "Standard"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
kubespawner_override:
image_pull_policy: Always
cpu_limit: 2
cpu_guarantee: 0.25
mem_limit: 2G
mem_guarantee: 0.5G
node_selector:
NodePool: default
# - display_name: "MIT Workshop (tmp)"
# description: "6 CPU / 16 GB up to 12C/32G. May take up to 15 mins to start."
# profile_options:
# image:
# display_name: "Image"
# choices:
# standard:
# display_name: "Standard"
# default: true
# kubespawner_override:
# image: "${singleuser_image_repo}:${singleuser_image_tag}"
# matlab:
# display_name: "MATLAB (must provide your own license)"
# kubespawner_override:
# image: "${singleuser_image_repo}:${singleuser_image_tag}-matlab"
# default: true
# kubespawner_override:
# image_pull_policy: Always
# cpu_limit: 12
# cpu_guarantee: 6
# mem_limit: 32G
# mem_guarantee: 16G
# node_selector:
# NodePool: cpu-on-demand
- display_name: "Base"
description: "6 CPU / 16 GB up to 12C/32G. May take up to 15 mins to start."
profile_options:
image:
display_name: "Image"
choices:
standard:
display_name: "Standard"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
matlab:
display_name: "MATLAB (must provide your own license)"
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-matlab"
default: true
kubespawner_override:
image_pull_policy: Always
cpu_limit: 12
cpu_guarantee: 6
mem_limit: 32G
mem_guarantee: 16G
node_selector:
NodePool: default
- display_name: "Medium"
description: "12C/32G up to 24C/64G. May take up to 15 mins to start."
profile_options:
image:
display_name: "Image"
choices:
standard:
display_name: "Standard"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
matlab:
display_name: "MATLAB (must provide your own license)"
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-matlab"
kubespawner_override:
image_pull_policy: Always
cpu_limit: 24
cpu_guarantee: 12
mem_limit: 64G
mem_guarantee: 32G
node_selector:
NodePool: default
- display_name: "Large"
description: "24C/64G up to 48C/96G. May take up to 15 mins to start."
profile_options:
image:
display_name: "Image"
choices:
standard:
display_name: "Standard"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
matlab:
display_name: "MATLAB (must provide your own license)"
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-matlab"
kubespawner_override:
image_pull_policy: Always
cpu_limit: 48
cpu_guarantee: 24
mem_limit: 96G
mem_guarantee: 64G
node_selector:
NodePool: default
- display_name: "T4 GPU for inference"
description: "8 CPU / 30 GB / 1 T4 GPU. May take up to 15 mins to start."
profile_options:
image:
display_name: "Image"
choices:
standard:
display_name: "Standard GPU"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-gpu"
matlab:
display_name: "MATLAB GPU (must provide your own license)"
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-gpu-matlab"
kubespawner_override:
image_pull_policy: Always
cpu_limit: 8
cpu_guarantee: 6
mem_limit: 31G
mem_guarantee: 25G
extra_resource_limits:
nvidia.com/gpu: "1"
node_selector:
NodePool: gpu
node.kubernetes.io/instance-type: g4dn.2xlarge
tolerations:
- key: "nvidia.com/gpu"
operator: "Exists"
effect: "NoSchedule"
- key: "hub.jupyter.org/dedicated" # According to optimization docs https://z2jh.jupyter.org/en/latest/administrator/optimization.html
operator: "Equal"
value: "user"
effect: "NoSchedule"
defaultUrl: "/lab"
memory:
limit: 16G
guarantee: 1G
cpu:
limit: 12
guarantee: 0.5
startTimeout: 2400
storage:
type: none
extraVolumes:
- name: fuse
hostPath:
path: /dev/fuse
- name: shm-volume
emptyDir:
medium: Memory
- name: persistent-storage-shared
persistentVolumeClaim:
claimName: efs-persist-shared
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-persist
extraVolumeMounts:
- name: fuse
mountPath: /dev/fuse
- name: shm-volume
mountPath: /dev/shm
- name: persistent-storage
mountPath: '/home/jovyan'
subPath: 'home/{username}'
- name: persistent-storage-shared
mountPath: '/shared'
subPath: 'shared'
- name: persistent-storage-shared
mountPath: '/readonly'
readOnly: true
subPath: 'readonly'
initContainers:
- name: nfs-fixer
image: alpine
securityContext:
runAsUser: 0
volumeMounts:
- name: persistent-storage
mountPath: /nfs
subPath: 'home/{username}'
- name: persistent-storage
mountPath: /shared
subPath: 'shared'
- name: persistent-storage
mountPath: /readonly
subPath: 'readonly'
command:
- sh
- -c
- >
chmod 0775 /nfs;
chown 1000:100 /nfs;
chmod 0775 /shared;
chown 1000:100 /shared;
chmod 0555 /readonly
cmd: "start-singleuser.sh"
lifecycleHooks:
postStart:
exec:
command:
- "sh"
- "-c"
- >
/opt/conda/envs/allen/bin/python -m ipykernel install --user --name allen --display-name "Python (Allen SDK)";
git config --global user.email "$${GITHUB_EMAIL}";
git config --global user.name "$${GITHUB_USER}"
serviceAccountName: ${jupyter_single_user_sa_name}
allowPrivilegeEscalation: true
extraPodConfig: # This is needed for Jovyan user running in every single pod, access the Service Account
securityContext:
fsGroup: 100
extraEnv: # Sudo needed to configure the proper permissions to start the notebook instance
GRANT_SUDO: "yes"
NOTEBOOK_ARGS: "--allow-root"
CHOWN_HOME: "yes"
CHOWN_HOME_OPTS: "-R"
CHOWN_EXTRA: "/home/shared"
uid: 0
fsGid: 0
cmd: null
# Optimizations configured according to this doc https://z2jh.jupyter.org/en/latest/administrator/optimization.html
scheduling:
userScheduler:
enabled: true
podPriority:
enabled: true
userPlaceholder:
enabled: false
# TODO(asmacdo) 4 in dandi branch
replicas: 1
userPods:
nodeAffinity:
matchNodePurpose: require # This will force single-user pods to use an specific karpenter provisioner
prePuller:
hook:
enabled: false
continuous:
# TODO(asmacdo) enable this for quicker deployment
# NOTE: if used with Karpenter, also add user-placeholders
enabled: false
global:
safeToShowValues: false