jupyterhub / zero-to-jupyterhub-k8s

Helm Chart & Documentation for deploying JupyterHub on Kubernetes
https://zero-to-jupyterhub.readthedocs.io
Other
1.55k stars 796 forks source link

Develop and test script to list usernames that will get escaped differently with KubeSpawner 7's safe slug scheme #3532

Open consideRatio opened 1 month ago

consideRatio commented 1 month ago

I think it can be useful for the upgrade guide to include a script to check username expansion differences. This could be useful in 2i2c deployments for example, so I figure I'll develop it anyhow.

minrk commented 1 month ago

Here's a draft of such a script. Notably, it compares the new supposedly unchanged 'escape' scheme with the new safe scheme, rather than comparing the actual current output of kubespawner.

It should be run in an existing hub pod via e.g.

cat compare_slugs.py | kubectl exec -it $(kubectl get pod -l component=hub -o name) -- python3 -

and installs kubespawner-dev in a venv.

In the hubs I administer, it produces no output (good) because the changed fields (pod_name) are loaded from state. I'm not sure if it would have caught #3536 or not.

minrk commented 1 month ago

This script as is should test that legacy pvc name is found and detected and uses actual config.

An alternative is to write a script that runs outside the Hub against the users list api and takes as input a list of templates to check. This is a less thorough check, but might be better suited in some scenarios.