Skip to content

Commit

Permalink
Merge pull request #854 from consideRatio/pr/template-docs-stuff
Browse files Browse the repository at this point in the history
docs: add example on upgrading slug scheme for a volume mount and list more template fields
  • Loading branch information
consideRatio authored Sep 22, 2024
2 parents 97ac911 + e9ce729 commit 5c9ac15
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion docs/source/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -103,6 +115,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)
Expand Down

0 comments on commit 5c9ac15

Please sign in to comment.