|
1 | 1 | { |
2 | | - "kind": "Template", |
3 | | - "apiVersion": "v1", |
4 | | - "metadata": { |
5 | | - "name": "jupyter-notebook", |
6 | | - "annotations": { |
7 | | - "openshift.io/display-name": "Jupyter Notebook", |
8 | | - "description": "Template for deploying Jupyter Notebook images.", |
9 | | - "iconClass": "icon-python", |
10 | | - "tags": "python,jupyter" |
| 2 | + "kind": "Template", |
| 3 | + "apiVersion": "v1", |
| 4 | + "metadata": { |
| 5 | + "name": "jupyter-notebook", |
| 6 | + "annotations": { |
| 7 | + "openshift.io/display-name": "Jupyter Notebook", |
| 8 | + "description": "Template for deploying Jupyter Notebook images.", |
| 9 | + "iconClass": "icon-python", |
| 10 | + "tags": "python,jupyter" |
| 11 | + } |
| 12 | + }, |
| 13 | + "parameters": [ |
| 14 | + { |
| 15 | + "name": "APPLICATION_NAME", |
| 16 | + "value": "notebook", |
| 17 | + "required": true |
| 18 | + }, |
| 19 | + { |
| 20 | + "name": "NOTEBOOK_IMAGE", |
| 21 | + "value": "jupyter/minimal-notebook:latest", |
| 22 | + "required": true |
| 23 | + }, |
| 24 | + { |
| 25 | + "name": "NOTEBOOK_PASSWORD", |
| 26 | + "from": "[a-f0-9]{32}", |
| 27 | + "generate": "expression" |
| 28 | + } |
| 29 | + ], |
| 30 | + "objects": [ |
| 31 | + { |
| 32 | + "kind": "ConfigMap", |
| 33 | + "apiVersion": "v1", |
| 34 | + "metadata": { |
| 35 | + "name": "${APPLICATION_NAME}-cfg", |
| 36 | + "labels": { |
| 37 | + "app": "${APPLICATION_NAME}" |
11 | 38 | } |
| 39 | + }, |
| 40 | + "data": { |
| 41 | + "jupyter_notebook_config.py": "import os\n\npassword = os.environ.get('JUPYTER_NOTEBOOK_PASSWORD')\n\nif password:\n import notebook.auth\n c.NotebookApp.password = notebook.auth.passwd(password)\n del password\n del os.environ['JUPYTER_NOTEBOOK_PASSWORD']\n\nimage_config_file = '/home/jovyan/.jupyter/jupyter_notebook_config.py'\n\nif os.path.exists(image_config_file):\n with open(image_config_file) as fp:\n exec(compile(fp.read(), image_config_file, 'exec'), globals())\n" |
| 42 | + } |
12 | 43 | }, |
13 | | - "parameters": [ |
14 | | - { |
15 | | - "name": "APPLICATION_NAME", |
16 | | - "value": "notebook", |
17 | | - "required": true |
18 | | - }, |
19 | | - { |
20 | | - "name": "NOTEBOOK_IMAGE", |
21 | | - "value": "jupyter/minimal-notebook:latest", |
22 | | - "required": true |
23 | | - }, |
24 | | - { |
25 | | - "name": "NOTEBOOK_PASSWORD", |
26 | | - "from": "[a-f0-9]{32}", |
27 | | - "generate": "expression" |
28 | | - } |
29 | | - ], |
30 | | - "objects": [ |
31 | | - { |
32 | | - "kind": "ConfigMap", |
33 | | - "apiVersion": "v1", |
34 | | - "metadata": { |
35 | | - "name": "${APPLICATION_NAME}-cfg", |
36 | | - "labels": { |
37 | | - "app": "${APPLICATION_NAME}" |
38 | | - } |
39 | | - }, |
40 | | - "data": { |
41 | | - "jupyter_notebook_config.py": "import os\n\npassword = os.environ.get('JUPYTER_NOTEBOOK_PASSWORD')\n\nif password:\n import notebook.auth\n c.NotebookApp.password = notebook.auth.passwd(password)\n del password\n del os.environ['JUPYTER_NOTEBOOK_PASSWORD']\n\nimage_config_file = '/home/jovyan/.jupyter/jupyter_notebook_config.py'\n\nif os.path.exists(image_config_file):\n with open(image_config_file) as fp:\n exec(compile(fp.read(), image_config_file, 'exec'), globals())\n" |
42 | | - } |
43 | | - }, |
44 | | - { |
45 | | - "kind": "DeploymentConfig", |
46 | | - "apiVersion": "v1", |
47 | | - "metadata": { |
48 | | - "name": "${APPLICATION_NAME}", |
49 | | - "labels": { |
50 | | - "app": "${APPLICATION_NAME}" |
51 | | - } |
52 | | - }, |
53 | | - "spec": { |
54 | | - "strategy": { |
55 | | - "type": "Recreate" |
56 | | - }, |
57 | | - "triggers": [ |
58 | | - { |
59 | | - "type": "ConfigChange" |
60 | | - } |
61 | | - ], |
62 | | - "replicas": 1, |
63 | | - "selector": { |
64 | | - "app": "${APPLICATION_NAME}", |
65 | | - "deploymentconfig": "${APPLICATION_NAME}" |
66 | | - }, |
67 | | - "template": { |
68 | | - "metadata": { |
69 | | - "annotations": { |
70 | | - "alpha.image.policy.openshift.io/resolve-names": "*" |
71 | | - }, |
72 | | - "labels": { |
73 | | - "app": "${APPLICATION_NAME}", |
74 | | - "deploymentconfig": "${APPLICATION_NAME}" |
75 | | - } |
76 | | - }, |
77 | | - "spec": { |
78 | | - "containers": [ |
79 | | - { |
80 | | - "name": "jupyter-notebook", |
81 | | - "image": "${NOTEBOOK_IMAGE}", |
82 | | - "command": [ |
83 | | - "start-notebook.sh", |
84 | | - "--config=/etc/jupyter/openshift/jupyter_notebook_config.py", |
85 | | - "--no-browser", |
86 | | - "--ip=0.0.0.0" |
87 | | - ], |
88 | | - |
89 | | - "ports": [ |
90 | | - { |
91 | | - "containerPort": 8888, |
92 | | - "protocol": "TCP" |
93 | | - } |
94 | | - ], |
95 | | - "env": [ |
96 | | - { |
97 | | - "name": "JUPYTER_NOTEBOOK_PASSWORD", |
98 | | - "value": "${NOTEBOOK_PASSWORD}" |
99 | | - } |
100 | | - ], |
101 | | - "volumeMounts": [ |
102 | | - { |
103 | | - "mountPath": "/etc/jupyter/openshift", |
104 | | - "name": "configs" |
105 | | - } |
106 | | - ] |
107 | | - } |
108 | | - ], |
109 | | - "automountServiceAccountToken": false, |
110 | | - "securityContext": { |
111 | | - "supplementalGroups": [ |
112 | | - 100 |
113 | | - ] |
114 | | - }, |
115 | | - "volumes": [ |
116 | | - { |
117 | | - "configMap": { |
118 | | - "name": "${APPLICATION_NAME}-cfg" |
119 | | - }, |
120 | | - "name": "configs" |
121 | | - } |
122 | | - ] |
123 | | - } |
124 | | - } |
125 | | - } |
| 44 | + { |
| 45 | + "kind": "DeploymentConfig", |
| 46 | + "apiVersion": "v1", |
| 47 | + "metadata": { |
| 48 | + "name": "${APPLICATION_NAME}", |
| 49 | + "labels": { |
| 50 | + "app": "${APPLICATION_NAME}" |
| 51 | + } |
| 52 | + }, |
| 53 | + "spec": { |
| 54 | + "strategy": { |
| 55 | + "type": "Recreate" |
126 | 56 | }, |
127 | | - { |
128 | | - "kind": "Route", |
129 | | - "apiVersion": "v1", |
130 | | - "metadata": { |
131 | | - "name": "${APPLICATION_NAME}", |
132 | | - "labels": { |
133 | | - "app": "${APPLICATION_NAME}" |
134 | | - } |
135 | | - }, |
136 | | - "spec": { |
137 | | - "host": "", |
138 | | - "to": { |
139 | | - "kind": "Service", |
140 | | - "name": "${APPLICATION_NAME}", |
141 | | - "weight": 100 |
142 | | - }, |
143 | | - "port": { |
144 | | - "targetPort": "8888-tcp" |
145 | | - }, |
146 | | - "tls": { |
147 | | - "termination": "edge", |
148 | | - "insecureEdgeTerminationPolicy": "Redirect" |
149 | | - } |
150 | | - } |
| 57 | + "triggers": [ |
| 58 | + { |
| 59 | + "type": "ConfigChange" |
| 60 | + } |
| 61 | + ], |
| 62 | + "replicas": 1, |
| 63 | + "selector": { |
| 64 | + "app": "${APPLICATION_NAME}", |
| 65 | + "deploymentconfig": "${APPLICATION_NAME}" |
151 | 66 | }, |
152 | | - { |
153 | | - "kind": "Service", |
154 | | - "apiVersion": "v1", |
155 | | - "metadata": { |
156 | | - "name": "${APPLICATION_NAME}", |
157 | | - "labels": { |
158 | | - "app": "${APPLICATION_NAME}" |
159 | | - } |
| 67 | + "template": { |
| 68 | + "metadata": { |
| 69 | + "annotations": { |
| 70 | + "alpha.image.policy.openshift.io/resolve-names": "*" |
160 | 71 | }, |
161 | | - "spec": { |
| 72 | + "labels": { |
| 73 | + "app": "${APPLICATION_NAME}", |
| 74 | + "deploymentconfig": "${APPLICATION_NAME}" |
| 75 | + } |
| 76 | + }, |
| 77 | + "spec": { |
| 78 | + "containers": [ |
| 79 | + { |
| 80 | + "name": "jupyter-notebook", |
| 81 | + "image": "${NOTEBOOK_IMAGE}", |
| 82 | + "command": [ |
| 83 | + "start-notebook.sh", |
| 84 | + "--config=/etc/jupyter/openshift/jupyter_notebook_config.py", |
| 85 | + "--no-browser", |
| 86 | + "--ip=0.0.0.0" |
| 87 | + ], |
| 88 | + |
162 | 89 | "ports": [ |
163 | | - { |
164 | | - "name": "8888-tcp", |
165 | | - "protocol": "TCP", |
166 | | - "port": 8888, |
167 | | - "targetPort": 8888 |
168 | | - } |
| 90 | + { |
| 91 | + "containerPort": 8888, |
| 92 | + "protocol": "TCP" |
| 93 | + } |
169 | 94 | ], |
170 | | - "selector": { |
171 | | - "app": "${APPLICATION_NAME}", |
172 | | - "deploymentconfig": "${APPLICATION_NAME}" |
| 95 | + "env": [ |
| 96 | + { |
| 97 | + "name": "JUPYTER_NOTEBOOK_PASSWORD", |
| 98 | + "value": "${NOTEBOOK_PASSWORD}" |
| 99 | + } |
| 100 | + ], |
| 101 | + "volumeMounts": [ |
| 102 | + { |
| 103 | + "mountPath": "/etc/jupyter/openshift", |
| 104 | + "name": "configs" |
| 105 | + } |
| 106 | + ] |
| 107 | + } |
| 108 | + ], |
| 109 | + "automountServiceAccountToken": false, |
| 110 | + "securityContext": { |
| 111 | + "supplementalGroups": [100] |
| 112 | + }, |
| 113 | + "volumes": [ |
| 114 | + { |
| 115 | + "configMap": { |
| 116 | + "name": "${APPLICATION_NAME}-cfg" |
173 | 117 | }, |
174 | | - "type": "ClusterIP" |
175 | | - } |
| 118 | + "name": "configs" |
| 119 | + } |
| 120 | + ] |
| 121 | + } |
| 122 | + } |
| 123 | + } |
| 124 | + }, |
| 125 | + { |
| 126 | + "kind": "Route", |
| 127 | + "apiVersion": "v1", |
| 128 | + "metadata": { |
| 129 | + "name": "${APPLICATION_NAME}", |
| 130 | + "labels": { |
| 131 | + "app": "${APPLICATION_NAME}" |
176 | 132 | } |
177 | | - ] |
| 133 | + }, |
| 134 | + "spec": { |
| 135 | + "host": "", |
| 136 | + "to": { |
| 137 | + "kind": "Service", |
| 138 | + "name": "${APPLICATION_NAME}", |
| 139 | + "weight": 100 |
| 140 | + }, |
| 141 | + "port": { |
| 142 | + "targetPort": "8888-tcp" |
| 143 | + }, |
| 144 | + "tls": { |
| 145 | + "termination": "edge", |
| 146 | + "insecureEdgeTerminationPolicy": "Redirect" |
| 147 | + } |
| 148 | + } |
| 149 | + }, |
| 150 | + { |
| 151 | + "kind": "Service", |
| 152 | + "apiVersion": "v1", |
| 153 | + "metadata": { |
| 154 | + "name": "${APPLICATION_NAME}", |
| 155 | + "labels": { |
| 156 | + "app": "${APPLICATION_NAME}" |
| 157 | + } |
| 158 | + }, |
| 159 | + "spec": { |
| 160 | + "ports": [ |
| 161 | + { |
| 162 | + "name": "8888-tcp", |
| 163 | + "protocol": "TCP", |
| 164 | + "port": 8888, |
| 165 | + "targetPort": 8888 |
| 166 | + } |
| 167 | + ], |
| 168 | + "selector": { |
| 169 | + "app": "${APPLICATION_NAME}", |
| 170 | + "deploymentconfig": "${APPLICATION_NAME}" |
| 171 | + }, |
| 172 | + "type": "ClusterIP" |
| 173 | + } |
| 174 | + } |
| 175 | + ] |
178 | 176 | } |
0 commit comments