Skip to content

Commit

Permalink
fix default pvc mounting with kubespawner 7
Browse files Browse the repository at this point in the history
- remove unneeded default for pvcNameTemplate
- use new `{pvc_name}` template field to mount the spawner's resolved pvc,
      rather than overriding the claim name, which may not match the created pvc
  • Loading branch information
minrk committed Oct 3, 2024
1 parent 3e200ab commit c3e818e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions jupyterhub/files/hub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ def camelCaseify(s):
storage_type = get_config("singleuser.storage.type")
if storage_type == "dynamic":
pvc_name_template = get_config("singleuser.storage.dynamic.pvcNameTemplate")
c.KubeSpawner.pvc_name_template = pvc_name_template
if pvc_name_template:
c.KubeSpawner.pvc_name_template = pvc_name_template
volume_name_template = get_config("singleuser.storage.dynamic.volumeNameTemplate")
c.KubeSpawner.storage_pvc_ensure = True
set_config_if_not_none(
Expand All @@ -275,7 +276,7 @@ def camelCaseify(s):
c.KubeSpawner.volumes = [
{
"name": volume_name_template,
"persistentVolumeClaim": {"claimName": pvc_name_template},
"persistentVolumeClaim": {"claimName": "{pvc_name}"},
}
]
c.KubeSpawner.volume_mounts = [
Expand Down
4 changes: 2 additions & 2 deletions jupyterhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ singleuser:
homeMountPath: /home/jovyan
dynamic:
storageClass:
pvcNameTemplate: claim-{username}{servername}
volumeNameTemplate: volume-{username}{servername}
pvcNameTemplate:
volumeNameTemplate: volume-{user_server}
storageAccessModes: [ReadWriteOnce]
subPath:
image:
Expand Down

0 comments on commit c3e818e

Please sign in to comment.