jupyterhub / binderhub

Run your code in the cloud, with technology so advanced, it feels like magic!
https://binderhub.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.57k stars 390 forks source link

BinderHub-generated environment overridden by default JupyterHub environments #1725

Open JColl88 opened 1 year ago

JColl88 commented 1 year ago

Bug description

I'm not 100% sure this is a bug, but I'm reporting here with a workaround in case it's useful to others.

When the jupyterhub.singleuser.profileList is set, the first of these seemingly overrides any environments spawned by Binder.

Behaviour

I would like to use BinderHub, while retaining utility of the associated JupyterHub as a standalone service.

In this example, JupyterHub is running at jupyterhub.url.com and Binder is running at binderhub.url.com. The Binder is configured with hub_url set to jupyterhub.url.com, so environments created via the Binder service are spawned on the JupyterHub running at jupyterhub.url.com.

I would like the JupyterHub to offer a range of 'prebuilt' environments the user can choose from, which is supplied via e.g.:

jupyterhub:
  singleuser:
      profileList:
      - display_name: "Env 1"
        kubespawner_override:
          image: <registry>/<image_1>:<tag>
      - display_name: "Env 2"
        kubespawner_override:
          image: <registry>/<image_2>:<tag>
...

This works as expected; when navigating directly to jupyterhub.url.com, the user is presented a range of environments to choose from.

If however, they launch a Binder from binderhub.url.com, when the image is created and the user redirected over to jupyterhub.url.com, the environment launched for them is the first in the profileList, rather than the newly created image.

How to reproduce

  1. Deploy BinderHub via Helm, with the jupyterhub.singleuser.profileList populated with a set of default environments.
  2. Navigate to the Binder service and try building a custom environment.

The workaround

This is seemingly related to the kubespawner_override for the first profile in the profileList. By simply removing the kubespawner_override from the first profile, both Binder and JupyterHub function as expected. i.e. Modify the above to:

jupyterhub:
  singleuser:
    profileList:
    - display_name: "Default"
    - display_name: "Env 1"
      kubespawner_override:
        image: <registry>/<image_1>:<tag>
    - display_name: "Env 2"
      kubespawner_override:
        image: <registry>/<image_2>:<tag>
...