-
Notifications
You must be signed in to change notification settings - Fork 0
/
values.yml
298 lines (284 loc) · 12.3 KB
/
values.yml
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
# This config is based off of the approach used by the Pangeo cloud deployments
# (https://github.com/pangeo-data/pangeo-cloud-federation)
jupyterhub:
prePuller:
hook:
enabled: false
continuous:
enabled: false
singleuser:
# see https://jupyterhub-kubespawner.readthedocs.io/en/latest/spawner.html for a
# description of configuration options
image:
pullPolicy: "Always"
name: gcr.io/rhg-project-1/notebook
tag: v1.0.0
startTimeout: 600
storage:
capacity: 10Gi
cpu:
limit: 3.5
guarantee: 3.5
memory:
limit: 22.5G
guarantee: 22.5G
cloudMetadata:
blockWithIptables: false
profileList:
- display_name: "Rhodium base: stable"
description: "Stable build of <a href=\"https://gitlab.com/rhodium/infra_management/google/jupyterhub-images/docker_images\">docker_images@master</a>. (v1.0.0)"
default: true
- display_name: "Rhodium base: stable (large)"
description: "Larger notebook allowance, with the stable build of <a href=\"https://gitlab.com/rhodium/infra_management/google/jupyterhub-images/docker_images\">docker_images@master</a> (v1.0.0)"
kubespawner_override:
cpu_limit: 7
cpu_guarantee: 7
mem_limit: 45G
mem_guarantee: 45G
- display_name: "Rhodium base: latest"
description: "Latest build of <a href=\"https://gitlab.com/rhodium/infra_management/google/jupyterhub-images/docker_images\">docker_images@master</a>."
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:latest
- display_name: "Rhodium base: latest (large)"
description: "Larger notebook allowance, with the latest build of <a href=\"https://gitlab.com/rhodium/infra_management/google/jupyterhub-images/docker_images\">docker_images@master</a>"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:latest
cpu_limit: 7
cpu_guarantee: 7
mem_limit: 45G
mem_guarantee: 45G
- display_name: "Octave: stable"
description: "Stable build of our Octave-enabled environment (v1.0.0)"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:v1.0.0-octave
- display_name: "Octave: stable (large)"
description: "Larger notebook allowance, with the stable build our Octave-enabled environment (v1.0.0)"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:v1.0.0-octave
cpu_limit: 7
cpu_guarantee: 7
mem_limit: 45G
mem_guarantee: 45G
- display_name: "Octave: latest"
description: "Latest build of our Octave-enabled environment"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:octave
- display_name: "Octave: latest (large)"
description: "Larger notebook allowance, with the latest build our Octave-enabled environment"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:octave
cpu_limit: 7
cpu_guarantee: 7
mem_limit: 45G
mem_guarantee: 45G
- display_name: "Coastal: stable"
description: "Stable build of our Coastal project environment (v1.0.0)"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:v1.0.0-coastal
- display_name: "Coastal: stable (large)"
description: "Larger notebook allowance, with the stable build our Coastal project environment (v1.0.0)"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:v1.0.0-coastal
cpu_limit: 7
cpu_guarantee: 7
mem_limit: 45G
mem_guarantee: 45G
- display_name: "Coastal: latest"
description: "Latest build of our Coastal project environment"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:coastal
- display_name: "Coastal: latest (large)"
description: "Larger notebook allowance, with the latest build of our Coastal project environment"
kubespawner_override:
image: gcr.io/rhg-project-1/notebook:coastal
cpu_limit: 7
cpu_guarantee: 7
mem_limit: 45G
mem_guarantee: 45G
# uncomment test image to run tests (typically just on adrastea)
# - display_name: "Rhodium base: test"
# description: "Test build of our Coastal project environment"
# kubespawner_override:
# image: gcr.io/rhg-project-1/notebook:test
hub:
resources:
requests:
cpu: "0.25"
memory: 0.5Gi
limits:
cpu: "1.25"
memory: 1Gi
extraConfig:
customPodHook: |
# runs container in privileged mode for FUSE mount access
from kubernetes import client
def modify_pod_hook(spawner, pod):
pod.spec.containers[0].security_context = client.V1SecurityContext(
privileged=True,
capabilities=client.V1Capabilities(
add=['SYS_ADMIN']
)
)
return pod
c.KubeSpawner.modify_pod_hook = modify_pod_hook
c.JupyterHub.logo_file = '/usr/local/share/jupyterhub/static/custom/images/logo.png'
c.JupyterHub.template_paths = ['/usr/local/share/jupyterhub/custom_templates/']
extraVolumes:
- name: custom-templates
gitRepo:
repository: "https://github.com/RhodiumGroup/rhodium-custom-jupyterhub-templates.git"
extraVolumeMounts:
- mountPath: /usr/local/share/jupyterhub/custom_templates
name: custom-templates
subPath: "rhodium-custom-jupyterhub-templates/templates"
- mountPath: /usr/local/share/jupyterhub/static/custom
name: custom-templates
subPath: "rhodium-custom-jupyterhub-templates/assets"
services:
dask-gateway:
apiToken: OVERRIDEME
scheduling:
userScheduler:
enabled: true
userPlaceholder:
enabled: false
userPods:
nodeAffinity:
matchNodePurpose: require
corePods:
nodeAffinity:
matchNodePurpose: require
cull:
timeout: 259200
proxy:
secretToken: OVERRIDEME
https:
enabled: true
letsencrypt:
contactEmail: [email protected]
auth:
type: github
scopes:
- "read:user"
- "read:org"
admin:
access: true
users:
- bolliger32
- brews
- delgadom
- dgergel
- mattgoldklang
dask-gateway:
gateway:
auth:
jupyterhub:
apiToken: OVERRIDEME
extraConfig:
optionHandler: |
from dask_gateway_server.options import Options, String, Select, Mapping, Float
from math import ceil
def cluster_options(user):
# A mapping from profile name to configuration overrides
# 12/15/20: always using one core unless explicitly defined by
# `cpus` due to this issue: https://github.com/dask/dask-gateway/issues/364
# Can update this behavior if that gets addressed
# standard_cores = 1.75
standard_mem = 11.25
scaling_factors = {
"micro": 0.5,
"standard": 1,
"big": 2,
"giant": 4
}
default_tolerations = {
"0": {
"key": "k8s.dask.org_dedicated",
"operator": "Equal",
"value": "worker",
"effect": "NoSchedule"
}
}
def option_handler(options):
if (":" not in options.worker_image) or (":" not in options.scheduler_image):
raise ValueError("When specifying an image you must also provide a tag")
extra_annotations = {
"hub.jupyter.org/username": user.name
}
default_extra_labels = {
"hub.jupyter.org/username": user.name,
}
this_env = options.env_items
# add extra pip packages to be picked up by prepare.sh
if options.extra_pip_packages != "":
this_env["EXTRA_PIP_PACKAGES"] = options.extra_pip_packages
# add gcsfuse Tokens
this_env["GCSFUSE_TOKENS"] = options.gcsfuse_tokens
# add google cloud auth if specified
if options.cred_name != "":
this_env["GOOGLE_APPLICATION_CREDENTIALS"] = f"/opt/gcsfuse_tokens/{options.cred_name}.json"
# calculate cpu request and limit
# see above comment for why we are commenting out standard_cores for now
# cpu_req = scaling_factors[options.profile] * standard_cores
# set threads appropriately
# (12/18/20) Currently setting to 1 b/c always only one thread available
# per dask thread
this_env["OMP_NUM_THREADS"]="1"
this_env["MKL_NUM_THREADS"]="1"
this_env["OPENBLAS_NUM_THREADS"]="1"
return {
"worker_cores": options.cpus,
# see https://github.com/dask/dask-gateway/blob/e409f0e87f45e0a51fd7c009b5ec010bc5253bf1/dask-gateway-server/dask_gateway_server/backends/kubernetes/controller.py#L1055
"worker_cores_limit": ceil(options.cpus), # this is necessary to get correct nthreads
"worker_memory": f"{scaling_factors[options.profile] * standard_mem:.2f}G",
# setting images separately here to get a light-weight scheduler
"worker_extra_container_config": {
"image": options.worker_image,
"imagePullPolicy": "Always",
"securityContext": {
"privileged": True # allows gcsfuse mount
}
},
"scheduler_extra_container_config": {
"image": options.scheduler_image,
"imagePullPolicy": "Always",
},
"worker_extra_pod_annotations": extra_annotations,
"worker_extra_pod_config": {
"tolerations": list(options.worker_tolerations.values())
},
"worker_extra_pod_labels": {
**default_extra_labels,
**options.extra_worker_labels,
},
"scheduler_extra_pod_annotations": extra_annotations,
"scheduler_extra_pod_labels": default_extra_labels,
"scheduler_extra_pod_config": {
"tolerations": list(default_tolerations.values()),
},
"environment": this_env,
"idle_timeout": 3600*6, # 6 hour idle timeout
"scheduler_cores": options.scheduler_cores,
"scheduler_memory": options.scheduler_memory,
}
return Options(
Select(
"profile",
["micro", "standard", "big", "giant"],
default="standard",
label="Cluster Memory Size"
),
Float("cpus", default=1, min=1, max=7, label="Worker CPUs"),
String("worker_image", default="gcr.io/rhg-project-1/worker:latest", label="Worker Image"),
String("scheduler_image", default="gcr.io/rhg-project-1/scheduler:latest", label="Scheduler Image"),
String("extra_pip_packages", default="", label="Extra pip Packages"),
String("gcsfuse_tokens", default="", label="GCSFUSE Tokens"),
String("cred_name", default="", label="Bucket for Google Cloud Creds"),
Mapping("worker_tolerations", default=default_tolerations, label="Worker Pod Tolerations"),
Mapping("extra_worker_labels", default={}, label="Extra Worker Pod Labels"),
Mapping("env_items", default={}, label="Environment Variables"),
String("scheduler_memory", default="22.5 G", label="Scheduler Memory"),
Float("scheduler_cores", default=3.5, min=1, max=7, label="Scheduler CPUs"),
handler=option_handler,
)
c.Backend.cluster_options = cluster_options