-
Notifications
You must be signed in to change notification settings - Fork 800
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
Z2JH 4.0.0 fails to detect old named server PVCs due to an overriden template in 3.3.8 #3574
Comments
Short-term, a deployment can work around this by
alternatively, we could write a bulk-rename script to rename PVCs. |
@minrk |
yes, servers that have upgraded and associated with new pvcs are going to be the hardest because we can't know if there's any data in the new pvcs that needs to be preserved, so the only safe option is to merge their contents, which we can't do automatically. But we could at least:
or perhaps the simplest is a script that iterates over existing PVCs and servers and pushes the pvc name into Spawner.state (i.e. effectively the same thing as preserving the old template, starting/stopping servers, then updating the template). |
Here is a script that does the last suggestion: https://gist.github.com/minrk/7ad21b18f7a5b3908d74f108dc564cd5 it collects all pvcs and spawners, then associates spawners with their pvcs.
it doesn't touch the pvcs themselves, just the association to the servers. Any dealing with removing new pvcs / merging content is something that has to be taken on a case-by-case basis. |
Do you think we should put your script into an optional initContainer in this chart? Perhaps with a flag to control how to resolve multiple matching PVCs (oldest, newest, or return an error to force the admin to sort things out before starting JupyterHub). |
Yes, possibly. I'm also investigating whether this belongs in the legacy pvc check in kubespawner, because I think we can change that to consider labels and annotations as well, so it's not sensitive to template changes across the upgrade. Either way, if we run this automatically for users, we will need to be careful to consider valid use cases of deliberate sharing of PVCs across servers, e.g.
whereas it is appropriate for the script above to only handle the default template case, since it is only run by hand, so users have a chance to make a decision whether it is appropriate before it runs. |
Nice script! Tried running |
Can you share more of the output of your script run (feel free to obfuscate usernames)? Does the output change at all from one run to the next? |
Output doesn't seem to change at all for either execs. Running Output:
Then we run Output:
However, seems that nothing actually changes since we get the same outputs if we run the same two commands above again. Same dry runs appear without apply and applying it always outputs the same "Made # changes" |
Sorry it doesn't seem to be working for you. Do you have JupyterHub running with active users, and is it running the z2jh 4 or 3? Specifically, have any of the affected servers started or stopped? I updated the script to log a bit more about what's going on. It shouldn't do anything different, but it might tell us why. When I run the script for the first time with:
I get several 'linking server...' messages, but if I run the same command a second time, I get:
|
Bug description
Reported in https://discourse.jupyter.org/t/jupyterhub-helm-chart-4-0-0/29887/2
How to reproduce
Expected behaviour
Z2JH should use the existing named PVC
Actual behaviour
3.3.8 set
pvcNameTemplate: claim-{username}{servername}
, overriding the KubeSpawner 6.2.0 default ofclaim-{username}--{servername}
https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/3.3.8/jupyterhub/values.yaml#L395
https://github.com/jupyterhub/kubespawner/blob/6.2.0/kubespawner/spawner.py#L569
4.0.0 uses the default from KubeSpawner
https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/4.0.0/jupyterhub/values.yaml#L416
As a result the automatic legacy PVC detection in KubeSpawner fails, since it assumes the 6.2.0 template is used
https://github.com/jupyterhub/kubespawner/blob/a8f28439078e42e8012de8f141b51bd6fa96d9c7/kubespawner/spawner.py#L3118
Instead of
claim-test-40example-2eorgnamed
The text was updated successfully, but these errors were encountered: