Skip to content

Commit

Permalink
make default_url a request query option
Browse files Browse the repository at this point in the history
  • Loading branch information
rokroskar committed Oct 10, 2018
1 parent 38e0e6f commit 33f7758
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions helm-chart/renku-notebooks/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ spec:
{{ else }}
value: {{ template "notebooks.http" . }}://{{ .Values.global.renku.domain }}{{ .Values.jupyterhub_base_url }}hub/api
{{ end }}
- name: JUPYTERHUB_SINGLEUSER_DEFAULT_URL
value: {{ .Values.jupyterhub.singleuser.defaultUrl }}
- name: JUPYTERHUB_SERVICE_PREFIX
value: {{ .Values.jupyterhub_base_url }}services/notebooks/
- name: JUPYTERHUB_BASE_URL
Expand Down
3 changes: 3 additions & 0 deletions jupyterhub/spawners.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ def get_pod_manifest(self):
# set the notebook container image
self.image_spec = self.image

# set the default url
self.default_url = options.get('default_url')

#: Define a new empty volume.
self.volumes = [
volume for volume in self.volumes if volume['name'] != volume_name
Expand Down
7 changes: 5 additions & 2 deletions src/notebooks_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@ def launch_notebook(user, namespace, project, commit_sha, notebook=None):
headers = {auth.auth_header_name: 'token {0}'.format(auth.api_token)}

# if there is an image passed with the request, use it
image = request.args.get(
'image', get_notebook_image(user, namespace, project, commit_sha)
image = get_notebook_image(user, namespace, project, commit_sha)

default_url = request.args.get(
'default_url', os.environ.get('JUPYTERHUB_SINGLEUSER_DEFAULT_URL')
)

payload = {
Expand All @@ -394,6 +396,7 @@ def launch_notebook(user, namespace, project, commit_sha, notebook=None):
'notebook': notebook,
'project': project,
'image': image,
'default_url': default_url,
}
if os.environ.get('GITLAB_REGISTRY_SECRET'):
payload['image_pull_secrets'] = payload.get('image_pull_secrets', [])
Expand Down

0 comments on commit 33f7758

Please sign in to comment.