Problem Statement
As a JupyterHub user, when I create a named server, sometimes it just breaks depending on the name of the server I use. After talking to my admin, I understand better that I'm not allowed to use some characters (like capital letters in some places). I am ok with being restricted, but would like to have a clearer idea of what characters I can and can not use, and clear feedback when I use them.
As a JupyterHub developer, I need to take the 'server name' into account in many places. These being unrestricted fields means they must be escaped, truncated, normalized, etc. which is a source of bugs and complications, often because these are not very widely used. Server names come up in:
- server URLs
- resources like pod names, container names, etc.
If I could assume more about the server name, I wouldn't need to do so much work to handle them.
Proposed Solution
Restrict the server name to a simpler, url-safe name, guaranteeing that it can be used unmodified in many contexts. Servers may also have an unrestricted "display name" that can be used for UI purposes only. This will need to be done in a way. The name rules should require that server names are:
- names are valid DNS labels
- valid URL components
- not empty
- fit within a maximum length
Proposed Implementation
For migration purposes, we can migrate any existing server name to use the current name as the 'display name', and use a slugify scheme to generate a safe version and deal with collisions once. We can migrate existing servers with non-compliant names via one-time slugification without breaking anything except for a one-time change of the URL for a server with a given name. A new "display_name" property may be added in some APIs and fields to allow rendering a nicer name, but all API endpoints will exclusively operate on 'true' (safe) names.
How will this fit in the ecosystem?
Spawners and URL-building tools that interact with JupyterHub will be able to use server.name as-is in more places, reducing confusion and complications from using free strings in APIs and URLs.
Endorsements
Problem Statement
As a JupyterHub user, when I create a named server, sometimes it just breaks depending on the name of the server I use. After talking to my admin, I understand better that I'm not allowed to use some characters (like capital letters in some places). I am ok with being restricted, but would like to have a clearer idea of what characters I can and can not use, and clear feedback when I use them.
As a JupyterHub developer, I need to take the 'server name' into account in many places. These being unrestricted fields means they must be escaped, truncated, normalized, etc. which is a source of bugs and complications, often because these are not very widely used. Server names come up in:
If I could assume more about the server name, I wouldn't need to do so much work to handle them.
Proposed Solution
Restrict the server name to a simpler, url-safe name, guaranteeing that it can be used unmodified in many contexts. Servers may also have an unrestricted "display name" that can be used for UI purposes only. This will need to be done in a way. The name rules should require that server names are:
Proposed Implementation
For migration purposes, we can migrate any existing server name to use the current name as the 'display name', and use a slugify scheme to generate a safe version and deal with collisions once. We can migrate existing servers with non-compliant names via one-time slugification without breaking anything except for a one-time change of the URL for a server with a given name. A new "display_name" property may be added in some APIs and fields to allow rendering a nicer name, but all API endpoints will exclusively operate on 'true' (safe) names.
How will this fit in the ecosystem?
Spawners and URL-building tools that interact with JupyterHub will be able to use
server.nameas-is in more places, reducing confusion and complications from using free strings in APIs and URLs.Endorsements