jupyterhub / kubespawner

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

Add extra_files configuration to mimic singleuser.extraFiles in z2jh #501

Open prateekkhera opened 3 years ago

prateekkhera commented 3 years ago

Background by Erik

Z2JH introduced singleuser.extraFiles configuration, allowing Helm chart configuration values to be automatically translated as file content and mounted as a file on the disk. This feature request was originally created in z2jh but in practice it would mean that KubeSpawner creates a extra_files configuration option just like Z2JH's hub.extraFiles and singleuser.extraFiles.

Documentation about singleuser.extraFiles is available here. Note that the documentation content is the same as for hub.extraFiles, so the examples are made for that, but the same logic applies.

Proposed change

Latest version introduced extraFiles which is a really nice feature. This feature request is to extend it to be supported in kubespawner_override so that different jupyter profiles can override this.

Alternative options

NA

Who would use this feature?

Currently, we're creating multiple docker images for each jupyter profiles. This is over couple of files, which are different across these images. This feature will help us to maintain just one docker image with those couple of files added ar the time of spawning single user notebook.

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:

consideRatio commented 3 years ago

I'm inclined to not want to do this, because it duplicates the logic of extraFiles into kubespawner from z2jh where it must also remain as it is used for hub.extraFiles also. Due to that, it adds significant complexity for the benefit of added convenience of using a convenience functionality.

The workaround I would suggest would be to:

  1. Use singleuser.extraFiles to name all the various combination that you want any user to have.
  2. Use a pre_spawn_hook to remove volume and volumeMount entries that have been added automatically by using singleuser.extraFiles, and let the pre_spawn_hook do this based on what you read in a profile_list "slug" which is a reference name for the profile that is easier to use than the human redable name.

For details on the first part, see z2jh docs on singleuser.extraFiles, for details on accomplishing the second part, see this jupyter forum post.