-
Notifications
You must be signed in to change notification settings - Fork 303
/
Copy pathjupyterhub_config.py
82 lines (73 loc) · 2.89 KB
/
jupyterhub_config.py
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
import os
import socket
c.JupyterHub.spawner_class = 'kubespawner.KubeSpawner'
c.JupyterHub.ip = '127.0.0.1'
c.JupyterHub.hub_ip = '127.0.0.1'
# Don't try to cleanup servers on exit - since in general for k8s, we want
# the hub to be able to restart without losing user containers
c.JupyterHub.cleanup_servers = False
# A small user image with jupyterlab that is easy to test against, assumed to be
# downloadable in less than 60 seconds.
c.KubeSpawner.image = 'jupyter/base-notebook:latest'
c.KubeSpawner.start_timeout = 60
if os.environ.get("CI"):
# In the CI system we use k3s which will be accessible on localhost.
c.JupyterHub.hub_connect_ip = "127.0.0.1"
else:
# Find the IP of the machine that minikube is most likely able to talk to
# Graciously used from https://stackoverflow.com/a/166589
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
host_ip = s.getsockname()[0]
s.close()
c.JupyterHub.hub_connect_ip = host_ip
# Simplify testing by using a dummy authenticator class where any username
# password combination will work and where we don't provide persistent storage.
c.JupyterHub.authenticator_class = 'dummy'
c.KubeSpawner.storage_pvc_ensure = False
c.JupyterHub.allow_named_servers = True
c.KubeSpawner.profile_list = [
{
'display_name': 'Demo - profile_list entry 1',
'description': 'Demo description for profile_list entry 1, and it should look good even though it is a bit lengthy.',
'slug': 'demo-1',
'default': True,
'profile_options': {
'image': {
'display_name': 'Image',
'choices': {
'base': {
'display_name': 'jupyter/base-notebook:latest',
'kubespawner_override': {
'image': 'jupyter/base-notebook:latest'
},
},
'minimal': {
'display_name': 'jupyter/minimal-notebook:latest',
'default': True,
'kubespawner_override': {
'image': 'jupyter/minimal-notebook:latest'
},
},
},
'unlisted_choice': {
'enabled': True,
'display_name': 'Other image',
'validation_regex': '^jupyter/.+:.+$',
'validation_message': 'Must be an image matching ^jupyter/<name>:<tag>$',
'kubespawner_override': {'image': '{value}'},
},
},
},
'kubespawner_override': {
'default_url': '/lab',
},
},
{
'display_name': 'Demo - profile_list entry 2',
'slug': 'demo-2',
'kubespawner_override': {
'extra_resource_guarantees': {"nvidia.com/gpu": "1"},
},
},
]