jupyterhub / kubespawner

Kubernetes spawner for JupyterHub
https://jupyterhub-kubespawner.readthedocs.io
BSD 3-Clause "New" or "Revised" License
549 stars 305 forks source link

Setting Spawner.environment does not seem to affect KubeSpawner.get_env() #485

Open danielballan opened 3 years ago

danielballan commented 3 years ago

Running Helm Chart version 0.11.1 (JupyterHub 1.3.0, KubeSpawner 0.15.0), I find that setting:

hub:
  extraConfig:
    00-spawner-env-config: |
      c.KubeSpawner.environment.update({"TEST_ENV": "HELLO"})

works as expected, setting TEST_ENV in the user environment, but

hub:
  extraConfig:
    00-spawner-env-config: |
      c.Spawner.environment.update({"TEST_ENV": "HELLO"})

has no effect on the user environment.

I'm sure this kind of configuration merging has worked for me in other contexts, and the traitlets Configurable docs are really clear on this exact point.

I have checked this a couple times to check that I'm not getting confused about what I'm seeing. It is definitely the case that setting the config Spawner instead of KubeSpawner does not set the environment variable. For my immediate purposes, this is a sufficient workaround, but it would be good to understand what is happening.

Originally reported in https://github.com/jupyterhub/zero-to-jupyterhub-k8s/pull/2062 as Point (3). Sent here by @consideRatio.

welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: