-
Notifications
You must be signed in to change notification settings - Fork 3
/
submit.yml.erb
63 lines (61 loc) · 2.11 KB
/
submit.yml.erb
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
<%
pwd_cfg = "c.NotebookApp.password=u\'sha1:${SALT}:${PASSWORD_SHA1}\'"
host_port_cfg = "c.NotebookApp.base_url=\'/node/${HOST_CFG}/${PORT_CFG}/\'"
configmap_filename = "ondemand_config.py"
configmap_data = "c.NotebookApp.port = 8080"
utility_img = "docker-registry.osc.edu/ondemand/ood-k8s-utils:v1.0.0"
user = OodSupport::User.new
%>
---
script:
accounting_id: "<%= account %>"
wall_time: "<%= wall_time.to_i * 3600 %>"
native:
container:
name: "jupyter"
image: "docker-registry.osc.edu/ondemand/scipy-notebook:python-3.9.2"
command: "/usr/local/bin/start.sh /opt/conda/bin/jupyter notebook --config=/ood/ondemand_config.py"
working_dir: "<%= Etc.getpwnam(ENV['USER']).dir %>"
restart_policy: 'OnFailure'
env:
NB_UID: "<%= user.uid %>"
NB_USER: "<%= user.name %>"
NB_GID: "<%= user.group.id %>"
HOME: "<%= user.home %>"
port: "8080"
cpu: "<%= cpu %>"
memory: "<%= memory %>Gi"
configmap:
files:
- filename: "<%= configmap_filename %>"
data: |
c.NotebookApp.port = 8080
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.disable_check_xsrf = True
c.NotebookApp.allow_origin = '*'
c.Application.log_level = 'DEBUG'
mount_path: '/ood'
mounts:
- type: host
name: home
host_type: Directory
path: <%= user.home %>
destination_path: <%= user.home %>
init_containers:
- name: "init-secret"
image: "<%= utility_img %>"
command:
- "/bin/save_passwd_as_secret"
- "user-<%= user.name %>"
- name: "add-passwd-to-cfg"
image: "<%= utility_img %>"
command:
- "/bin/bash"
- "-c"
- "source /bin/passwd_from_secret; source /bin/create_salt_and_sha1; /bin/add_line_to_configmap \\\"<%= pwd_cfg %>\\\" <%= configmap_filename %>"
- name: "add-hostport-to-cfg"
image: "<%= utility_img %>"
command:
- "/bin/bash"
- "-c"
- "source /bin/find_host_port; /bin/add_line_to_configmap \\\"<%= host_port_cfg %>\\\" <%= configmap_filename %>"