Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #111 from rimolive/rmartine
Browse files Browse the repository at this point in the history
Fix env var placement with custom jupyter notebooks namespace
  • Loading branch information
vpavlin authored Aug 12, 2021
2 parents ee34617 + af0e8ac commit 1366504
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 113 deletions.
9 changes: 5 additions & 4 deletions .jupyter/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
# Do not shut down singleuser servers on restart
c.JupyterHub.cleanup_servers = False

custom_notebook_namespace = os.environ.get('NOTEBOOK_NAMESPACE')

import uuid
jsp_api_dict = {
'KUBERNETES_SERVICE_HOST': os.environ['KUBERNETES_SERVICE_HOST'],
'KUBERNETES_SERVICE_PORT': os.environ['KUBERNETES_SERVICE_PORT'],
'JUPYTERHUB_LOGIN_URL': None
'JUPYTERHUB_LOGIN_URL': None,
'NOTEBOOK_NAMESPACE': custom_notebook_namespace
}

from jupyterhub_singleuser_profiles.openshift import OpenShift
Expand Down Expand Up @@ -59,8 +62,6 @@ def set_culler_secret():

DEFAULT_MOUNT_PATH = '/opt/app-root/src'

custom_notebook_namespace = os.environ.get('NOTEBOOK_NAMESPACE')

# Work out the public server address for the OpenShift REST API. Don't
# know how to get this via the REST API client so do a raw request to
# get it. Make sure request is done in a session so connection is closed
Expand Down Expand Up @@ -192,7 +193,7 @@ class OpenShiftSpawner(KubeSpawner):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.single_user_services = []
self.single_user_profiles = SingleuserProfiles(gpu_mode=os.environ.get('GPU_MODE'), verify_ssl=verify_ssl)
self.single_user_profiles = SingleuserProfiles(gpu_mode=os.environ.get('GPU_MODE'), notebook_namespace=custom_notebook_namespace, verify_ssl=verify_ssl)
self.gpu_mode = self.single_user_profiles.gpu_mode
self.gpu_count = 0
self.deployment_size = None
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ verify_ssl = true

[packages]
openshift = "==0.11.2"
jupyterhub-singleuser-profiles = "==0.5.1"
jupyterhub-singleuser-profiles = "==0.6.0"
oauthenticator = {ref = "d98936da37569b7bb400c6854b07041dce3e7f87",git = "https://github.com/opendatahub-io/oauthenticator.git", editable = true}
jupyterhub-traefik-proxy = {ref = "b468da04bf0057e9baeb458de6c3f9f677cfb79e", git = "https://github.com/opendatahub-io/traefik-proxy.git", editable = true}
jupyterhub-idle-culler = "==1.1"
Expand Down
Loading

0 comments on commit 1366504

Please sign in to comment.