Skip to content

Commit

Permalink
Fix issue with environment variables be overriden in k8s mode
Browse files Browse the repository at this point in the history
  • Loading branch information
raethlein committed Sep 18, 2019
1 parent 6f189a6 commit 5eef2dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docker-res/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
c.Spawner.port = int(os.getenv("DEFAULT_WORKSPACE_PORT", 8080))

# Set default environment variables used by our ml-workspace container
c.Spawner.environment = {"AUTHENTICATE_VIA_JUPYTER": "true", "SHUTDOWN_INACTIVE_KERNELS": "true"}
default_env = {"AUTHENTICATE_VIA_JUPYTER": "true", "SHUTDOWN_INACTIVE_KERNELS": "true"}
c.Spawner.environment = default_env

# Workaround to prevent api problems
c.Spawner.will_resume = True
Expand Down Expand Up @@ -75,6 +76,10 @@
c.JupyterHub.spawner_class = 'mlhubspawner.MLHubKubernetesSpawner'
c.KubeSpawner.pod_name_template = c.Spawner.name_template

if not isinstance(c.KubeSpawner.environment, dict):
c.KubeSpawner.environment = {}
c.KubeSpawner.environment.update(default_env)

# Add nativeauthenticator-specific templates
if c.JupyterHub.authenticator_class == NATIVE_AUTHENTICATOR_CLASS:
import nativeauthenticator
Expand Down

0 comments on commit 5eef2dd

Please sign in to comment.