-
Notifications
You must be signed in to change notification settings - Fork 309
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
add image_whitelist and default options form #219
Conversation
f5787ad
to
2e52cb7
Compare
One thing I'd like is to be able to specify different images for different groups. I'm not sure if there is currently any concept of a group membership for authenticated users? It's something I've been meaning to look into... |
In the config I would hard-code the allowed images for each group - i.e. the
The allowed images would then be chosen from the union of all groups the user was a member of and the options form would group the image names by the group name. I understand if this is too specialised a usecase to be incorporated in DockerSpawner itself - I just wanted to put it out there as something to consider... |
I'd ideally like this to be configurable in the JupyterHub admin UI - it would be a bit awkward to have to restart JupyterHub just to add a new image to the whitelist |
Thanks for your use case. I think I probably won't have support for group-specific image lists in the base class since I think that can take too many forms, but I'll make sure that the necessary overrides are convenient via config, so all you'll have to provide is a callable that returns the right whitelist for the current user. As for groups, yes JupyterHub does have the concept of groups, though a user can be a member of multiple groups (like unix), so you have to be a little careful. There isn't UI for managing groups, but you can do it via REST and/or config. Admin UI can only be used to affect values stored in the db, not config. Anything that lives only in config would get lost on Hub relaunch. |
Just for completeness' sake I'll point out that my proposal is similar/related to the below issues which are spread about different repos: |
if c.DockerSpawner.image_whitelist is specified, a default options form is constructed with a select dropdown for choosing the image to launch. image_whitelist is a dict of key: image, where the key is the value to be used in the form, while the values are the actual docker images. image_whitelist may be specified as a list, in which case it is cast to a dict of the form {image:image}, where the keys are the same as the values (users see actual image names, rather than abbreviations/descriptions).
Would it make sense to design |
@nils-werner that's already how it works, since this functionality is defined on DockerSpawner and SwarmSpawner is a subclass, so it inherits everything from DockerSpawner. @dhirschfeld this now allows |
I mean as mixins, not just deriving from one class. Using mixins, I could create a spawner that offers both systemuser and swarm using
Following this principle, launching multiple docker images could be put in another mixin and be used like
|
So that it can be derived from the user callable will be passed the Spawner as a single argument. User is accessible as Spawner.user.
@minrk is this finished now? when will it be merged into the dockerSpawner ? |
Yes, I believe this is ready. |
@minrk working like a charm! |
Is this functionality working in 0.10? I wrote in jupyterhub_config.py But... logs adive Using Ldapauthenticator |
Is there a documentation page for this functionality or any examples? |
I'm interested for docs on this too... eg I'm using a simple |
This functionality is not part of the official release yet. You have to install dockerspawner from this repo master branch (explained here). Hope this help! |
@pinsleepe Yep, I've been using installs from the Guthub masters. |
I'm keen to use this functionality but need a release to be able to do so easily |
Dito. |
Working on the 0.11 release now. |
How can I map a specific volume to each of the images in the white list? something like: c.DockerSpawner.volumes = {'host/directory':'/container/directory'} |
if c.DockerSpawner.image_whitelist is specified, a default options form is constructed with a select dropdown for choosing the image to launch.
image_whitelist is a dict of
{key: image}
, where the key is the value to be used in the form (and shown to humans), while the values are the actual docker images. In this case, the actual image name is not shown to users.image_whitelist
may be specified as a list, in which case it is cast to a dict of the form{image:image}
, where the keys are the same as the values (users see actual image names, rather than abbreviations/descriptions).closes #236