ideonate / cdsdashboards

JupyterHub extension for ContainDS Dashboards
https://cdsdashboards.readthedocs.io/
Other
200 stars 38 forks source link

Is DockerSpawner.allowed_images (was image_whitelist) a replacement for cdsdashboards.hubextension.spawners.variabledocker.VariableDockerSpawner ? #50

Closed milutz closed 3 years ago

milutz commented 3 years ago

Now that the base DockerSpawner code supports multiple images through DockerSpawner.allowed_images is cdsdashboards.hubextension.spawners.variabledocker.VariableDockerSpawner still needed?

If it is, is it compatible with DockerSpawner.allowed_images?

Looking at the code that I think implements that ... (I'm not good with Mixins) ... is it still needed to enable the override of the invocation command on the docker image?

danlester commented 3 years ago

Thank you for raising the question.

First of all, I don't believe anything fundamental has changed with DockerSpawner for quite a while - as you say, they have just renamed the setting.

But I think your question remains... To be honest, I haven't really considered the case where you have an allowed_images list. I think as long as there is a default image set for your DockerSpawner config, then it will just use that as the image, and essentially ignore the allowed_images list.

However, there are two settings that are relevant here - see Source Servers which says you can set:

c.CDSDashboardsConfig.show_source_servers = True
c.CDSDashboardsConfig.require_source_server = True

This will add an extra option when you create the dashboard, asking you to select a 'source server' (perhaps your regular default 'My Server') which will be cloned into a new Docker image for the dashboard. I don't think this functionality is quite what you will want, but I thought I'd mention it anyway, and it is a way to vary the base image used for the dashboard. I imagine that ideally you are looking for a drop-down of Docker images (your allowed_images list) to select from.

To directly answer your question, there is no way that the allowed_images list means that VariableDockerSpawner is not needed. It is essential for switching which app is launched - e.g. Voilà/Streamlit instead of the regular Jupyter notebook server.

A lot of this may depend on your exact configuration, so I think the best way forward would be to find out what does happen on your system when you have an allowed_images list, and let me know whether it seems to do something sensible in your opinion!

danlester commented 3 years ago

The latest version 0.5.0 will allow 'user options forms', e.g. selecting the Docker image to use for a dashboard when allowed_images contains more than one possible selection.

Try:

c.CDSDashboardsConfig.spawn_default_options = False

as described here.

milutz commented 3 years ago

Great, thanks @danlester, I'll check it out!