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

Allow for alternate commands and images #135

Closed
jacobtomlinson opened this issue Feb 20, 2018 · 14 comments
Closed

Allow for alternate commands and images #135

jacobtomlinson opened this issue Feb 20, 2018 · 14 comments

Comments

@jacobtomlinson
Copy link

I'm keen to allow users to select their docker image and the command which starts the singleuser notebook from a dropdown of predefined options when they log in.

I've seen this done before in projects like kubeflow and @yuvipanda has also mentioned it to me in the past. However I am unable to find any docs on how to do this.

If my google-fu is letting me down could someone please point me to the right place? Otherwise perhaps there should be some example docs on how to do this.

@yuvipanda
Copy link
Collaborator

yuvipanda commented Feb 20, 2018 via email

@betatim
Copy link
Member

betatim commented Feb 21, 2018

In general your spawner can have an "options form", for an example on how kubeflow does it: https://github.com/kubeflow/kubeflow/blob/30f913986607bb8414d51ef6a23fe60fec9afe3c/kubeflow/core/jupyterhub_spawner.py

I think this answers your question for how to DIY it (and then make a PR with a general solution :-P)

@jacobtomlinson
Copy link
Author

Awesome stuff thanks guys. I'll try and take a look at this today.

@gsemet
Copy link
Contributor

gsemet commented Mar 1, 2018

Hello. I have made a proposal of evolution on KubeSpawner at the following ticket: jupyterhub/zero-to-jupyterhub-k8s#545 (comment)

It would add a new option c.KubeSpawner.single_user_profile_list is added and could take precedence over any setting of KubeSpawner. This option is a list of dictionnary of form:

{
    'display_name': 'Human Readable Profile Title',
    'image_spec': 'image/to_execute:label'
    'cpu_limit': cpu_limit,
    'cpu_guarantee': cpu_guarantee,
    'mem_limit': mem_limit,
    'mem_guarantee': mem_guarantee,
    'lifecycle_hooks': lifecycle_hooks,
    'volume_mounts': volume_mounts,
    ...
}

or better:

{
    'display_name': 'Human Readable Profile Title',
    'kubespawner_overrride`: {
        'image_spec': 'image/to_execute:label'
        'cpu_limit': cpu_limit,
        ...
    }
}

Where, appart the 'display_name', all other keys are settings that can replace the setting defined in c.KubeSpawner with the principle "if set, take this value, even if set to None, in key is not set, use the setting in c.KubeSpawner).

I am not a fan to let user decide how many CPU or memory he wants. Maybe as an option, but I clearly prefere a predefined list of profiles

gsemet added a commit to gsemet/kubespawner that referenced this issue Mar 1, 2018
gsemet added a commit to gsemet/kubespawner that referenced this issue Mar 11, 2018
gsemet added a commit to gsemet/kubespawner that referenced this issue Mar 19, 2018
gsemet added a commit to gsemet/kubespawner that referenced this issue Mar 22, 2018
gsemet added a commit to gsemet/kubespawner that referenced this issue Mar 26, 2018
@ablekh
Copy link

ablekh commented Oct 26, 2018

Why is this issue still open? I thought that #137 resolves it. Am I missing something?

@jacobtomlinson
Copy link
Author

It did, you're not!

@consideRatio
Copy link
Member

Thanks for great work on this @gsemet !!

@gsemet
Copy link
Contributor

gsemet commented Oct 27, 2018

Thanks! But it been some time already :) hope it helps, I use it intensively (this allows me to work on my docker images while still providing the old ones and the ones maintained by jupyter, because regressions happen)

Fun fact: you can use it to request larger PVC (if it has been deleted)

@ablekh
Copy link

ablekh commented Oct 27, 2018

@gsemet Could you point to a comprehensive documentation / description / blog post for this feature (beyond relevant c.KubeSpawner.profile_list entry in the official KubeSpawner documentation), if it exists? Specifically, I'm interested in a wider variety of examples. Also, I'm curious why the options screen I've seen shared by @consideRatio are quite different in visual appearance from the default (radio buttons vs. drop-down list) - any special option that controls that? Thanks in advance.

@gsemet
Copy link
Contributor

gsemet commented Oct 27, 2018

Good idea, I could make it someday :)

There have been a (good) rework of the ui by yuvipanda, now it looks great with the combox boxes.

@consideRatio
Copy link
Member

ah ❤️ @yuvipanda also for this, started using this last week. Love it!

@rabernat
Copy link

Would really love a bit more documentation / examples about how to use this feature.

@consideRatio
Copy link
Member

consideRatio commented Dec 2, 2018

@rabernat As a quickfix example, see the profile_list configured here: jupyterhub/zero-to-jupyterhub-k8s#994

@betatim
Copy link
Member

betatim commented Dec 2, 2018

Would really love a bit more documentation / examples about how to use this feature.

What specifically is unclear or would you like showing off more in an example @rabernat?

The documentation already contains an example similar to what Erik linked to. Maybe the way to go is for you to make a PR that makes the example in the docs more useful for newcomers?

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

7 participants