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

start.sh usermod and kubespawner mount volumes in home #574

Closed
djangoliv opened this issue Feb 23, 2022 · 4 comments
Closed

start.sh usermod and kubespawner mount volumes in home #574

djangoliv opened this issue Feb 23, 2022 · 4 comments
Labels

Comments

@djangoliv
Copy link

I am using base-notebook

In jupyterhub_config.py I add a volume:

c.KubeSpawner.volume_mounts = [
    {
        'name': 'common',
        'mountPath': '/home/{username}/my_dir',
    },
]

So kubspawner creates the '/home/{username}' directory before running start.sh
In start.sh: After the usermod that changes jovyan to {username} there is a copy of /home/jovyan to /home/{username} but only if /home/{username} does not yet exist.
But with the volume, the home of {username} already exists and the copy does not happen.

Maybe we can force the copy with an environment variable ($COPY_HOME) and not test if the home already exists.

Any suggestions are welcome.

Regards

@djangoliv djangoliv added the bug label Feb 23, 2022
@manics
Copy link
Member

manics commented Feb 23, 2022

It sounds like this needs to be managed in your container, not KubeSpawner:
https://github.com/jupyter/docker-stacks/blob/69ddfa810e503342713cd5fac76fbc767ebb5c8b/base-notebook/start.sh#L67-L201

@manics manics closed this as completed Feb 23, 2022
@manics manics added support and removed bug labels Feb 23, 2022
@consideRatio
Copy link
Member

This is a discussion related to jupyter/docker-stacks. My understanding is that you discuss the following feature summarized.

  1. You have ensured there is a /home/{username}/some_dir ahead of time
  2. As part of the start.sh script of jupyter/docker-stacks runs, you have made it switch from a jovyan user to {username}. As part of this script running, you want to be able to make start.sh change its default behavior when the {username} home folderexists. You want either to replace the {username} folder if it exists, or in some way merge content from jovyan home folder to the existing {username} folder.

I would overall say that this is a quite uncommon action, and could easily lead to loss of data if misunderstood by someone. Due to that, I'm not so happy about the idea of supporting a feature like that - if I understood it correctly.

@consideRatio consideRatio reopened this Feb 23, 2022
@consideRatio
Copy link
Member

Oh... I couldn't transfer this issue to jupyter/docker-stacks as it was outside the organization. Anyhow, that is where this belongs. You could perhaps copy paste things from this to there if you want to raise it for discussion? Please if so, also include my response.

@benz0li
Copy link

benz0li commented Mar 9, 2022

@djangoliv If you mounted /home/{username} instead of /home/{username}/some_dir your use case would be the same as jupyter/docker-stacks#1478.

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

No branches or pull requests

4 participants