-
Notifications
You must be signed in to change notification settings - Fork 298
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
Server names starting with upper letter fail to start #737
Comments
I have checked my installed version and I have v6.0.0. Going to the code I see the issue here: I have added this to my code:
And using as server name
These are the pod labels:
|
Ah, I see - the @minrk are servernames case insensitive? Can we lowercase the servername first before escaping? |
Server names aren't restricted by JupyterHub (I know, I should have specified a strict, limited schema), but it's a namespace entirely controlled by each user, so I don't think you need to worry about case sensitivity. A user definitely can create case collisions if they really want to shoot themselves in the foot by naming their servers COLLISION and collision. They can't shoot at any other feet, though. Changing escaping can lead to lost volumes, though, so need to be careful about that. But just like other things we use for labels, we can't assume that things won't start with escape-needing characters, so we need to handle that in KubeSpawner. Case insensitivity wouldn't solve this if another escaped character were at the beginning. We need to solve it in our slug-generation code to produce valid labels when the first character is |
An approach I took at one point in jupyterhub/jupyterhub#4471 to avoid backward-compatibility breakage is to specifically check if names need escaping, and opt-in to the new scheme when they do. That provides a path to backward-compatibility by having two schemes - one that's unchanged from before, and another that's only taken in the situations that we know don't work already. i.e. something like: name = current_scheme()
if not is_valid_name(name):
name = ensure_valid_name(name) That way, it's fully backward compatible in that it only changes the scheme for names that don't work today. We can do a smaller version of this to specifically catch the starts-with-escape case, but we do know there are other ways to produce invalid names (max length, etc.). The approach is the same, it's just in the definitions of |
@minrk think you'll have any time to work on such an approach? |
I'm not sure. Possibly, but I wouldn't count on it in the next few weeks. If I were to do it, I would probably go with finishing #744 and adding a backward-compatible scheme that preserves the old scheme, but opts into the new 'safe' one in cases of known failure. We could also do a totally separate backward-compatibility PR that ensures all of these templated fields go in Spawner state (volumes, etc.), so they don't get rerendered when config changes, no matter what, i.e. pod_name = state.get("pod_name", templated_name)
volume_name = state.get("volume_name", templated_volume_name) But I suspect that's going to be really hard to do in general, given how completely freely our templated strings can be used. It will also be hard to say which keys should expire on stop vs persisting (e.g. pod name should expire, volume name should not...usually!) |
My cluster is only 60 or so instances so this is probably easier for me, but an opt in switch to modernize the naming scheme would be better for me. IE, let me pick which scheme to use so I can control when the template changes. The proposed solution is the worst for me because we make assumptions about the naming scheme in our environment and new pods that can show up that don't match the scheme would be terrible. |
That's what #744 does now. |
Bug description
Named server that start with an upper letter produces escaped labels with invalid characters in label annotations. E.g. for "RStudioServerOption" I get this error from kubernetes:
Expected behaviour
Named servers work independently of the name used
Actual behaviour
How to reproduce
Your personal set up
zero-to-jupyterhub with several customisations, jupyterhub-kubespawner v5.0.0
Issue is similar to #730 and #498
The text was updated successfully, but these errors were encountered: