From b24f57649807bde846cc01b082bbb56af9bac32c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sun, 22 Sep 2024 16:55:06 +0200 Subject: [PATCH 1/2] docs: add example about volume mount in templates upgrade section --- docs/source/templates.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/source/templates.md b/docs/source/templates.md index b41c807a..8ebe9298 100644 --- a/docs/source/templates.md +++ b/docs/source/templates.md @@ -103,6 +103,21 @@ c.KubeSpawner.slug_scheme = "escape" # no changes from kubespawner 6 c.KubeSpawner.slug_scheme = "safe" # default for kubespawner 7 ``` +You can also adjust individual template fields to expand independent of +configured slug scheme. If you for example previously have mounted a folder +named `{username}` for a single NFS volume with all user's home folders, a +change of slug scheme could lead to mounting a different folder. To avoid this, +you can stick with the previous behavior for the volume mount specifically by +referencing `{escaped_username}` instead. + +```python +c.KubeSpawner.volume_mounts = { + "name": "home", + "mountPath": "/home/jovyan", + "subPath": "{escaped_username}", # matches "{username}" in kubespawner 6 +} +``` + The new scheme has the following rules: - the length of any _single_ template field is limited to 48 characters (the total length of the string is not enforced) From e9ce729f246d8d6084e79d3825a3b21d1444f07b Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sun, 22 Sep 2024 12:52:49 +0200 Subject: [PATCH 2/2] docs: update list of templated fields --- docs/source/templates.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/source/templates.md b/docs/source/templates.md index 8ebe9298..1db33287 100644 --- a/docs/source/templates.md +++ b/docs/source/templates.md @@ -16,10 +16,22 @@ so for example the default `pod_name_template` of `"jupyter-{user_server}"` will ## templated properties -Some common templated fields: +Templated fields include: +- [extra_annotations](#KubeSpawner.extra_annotations) +- [extra_containers](#KubeSpawner.extra_containers) +- [extra_labels](#KubeSpawner.extra_labels) +- [pod_connect_ip](#KubeSpawner.pod_connect_ip) - [pod_name_template](#KubeSpawner.pod_name_template) - [pvc_name_template](#KubeSpawner.pvc_name_template) +- [storage_extra_annotations](#KubeSpawner.storage_extra_annotations) +- [storage_extra_labels](#KubeSpawner.storage_extra_labels) +- [storage_selector](#KubeSpawner.storage_selector) +- [user_namespace_annotations](#KubeSpawner.user_namespace_annotations) +- [user_namespace_labels](#KubeSpawner.user_namespace_labels) +- [user_namespace_template](#KubeSpawner.user_namespace_template) +- [volume_mounts](#KubeSpawner.volume_mounts) +- [volumes](#KubeSpawner.volumes) - [working_dir](#KubeSpawner.working_dir) ## fields