Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variable "NB_USER":"{username}" doesn't expand #395

Closed
atanasov-ka opened this issue Feb 1, 2020 · 2 comments
Closed

Environment variable "NB_USER":"{username}" doesn't expand #395

atanasov-ka opened this issue Feb 1, 2020 · 2 comments

Comments

@atanasov-ka
Copy link

I put the following environment variable to KubeSpawner but it seems that expansion is not supported over env variables.

dict(singleuser_image_spec="....",
environment={
'CHOWN_HOME': 'yes'
'NB_USER': '{username}'
},
....
)

If that isn't possible to fix maybe to add another property called for example "environment_expandable" which will allow to receive such variables?

@manics
Copy link
Member

manics commented Feb 1, 2020

If you need to dynamically set environment variables you can use a pre_spawn_start hook:
https://jupyterhub.readthedocs.io/en/latest/reference/authenticators.html#using-auth-state

@consideRatio
Copy link
Member

I know you can use "NB_USER": "$(JUPYTERHUB_USER)" to rely on k8s environment expansion instead of Kubespawners expansion, where the JUPYTERHUB_USER environment variable is set here by the Spawner base class that KubeSpawner inherits from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants