Hi!
We are looking into allowing our customers to test out the software we distribute through Jupyterhub hosted in Azure (kubernetes). Generally, I am very happy with the guide “zero to kubernetes” which I used to set up most of the infrastructure, without much prior experience working with kubernetes, network, azure etc, so kudos for that!. However, I am struggling to set up authentication.
Our current wish is to use Azure ADB2C. I can see that OAuthenticator had support for this at some point in late 2019, but it was removed on the grounds that you could use the Azure AD Authenticator for this. However, when I tried the Azure AD auth I end up setting up the auth to use “regular AAD”. By looking into the endpoints used by the ADB2C tenant I see that this makes sense as Azure have recently moved B2C tenants to new endpoints and the “old” ones now refer to “regular AAD”. In the AAD authenticator code the old style endpoints are hard-coded so this cannot currently be used for new B2C tenants, and not for any B2C tenants some time after 2021.01.14 (see OAuthenticator github issue). Based on replies from the jupyterhub team in topics/issues regarding specific/custom authenticators, I decided to create my own B2C authenticator in which I simply adapt the code mentioned above by updating the endpoints.
My approach is to extend the jupyterhub hub-image by installing my own authenticator and deploy this through specifying this hub-image in the chart config file: “hub.image.name/tag” as well as the authenticator: “auth.custom.className”, inspired by the topic with the title “Adding authenticators, spawners or other custom pieces in the Z2JH setup” (I was only allowed two links). However, after running helm upgrade, the hub pod gets stuck in CrashLoopBack. When I print the logs, I see that it fails with the error “ModuleNotFoundError: No module named ‘kubernetes’” (python error) during the loading of the config file. My derived Dockerfile is shown below where the copy step copies in the custom python package:
FROM jupyterhub/jupyterhub:1.1.0
RUN mkdir -p /srv/auth/
WORKDIR /srv/auth/
COPY . .
RUN python3 -m pip install --no-cache .
WORKDIR /srv/jupyterhub/
I interpret this as if my added steps somehow invalidates the python environment, but I have no idea how or why. Does anyone have any ideas what may cause this issue? And please let me know if you see any flaws in my approach or know of a better way!
Thank you