Creating 1 PVC per profile and per user

Hi, I have a Jupyter hub instance with multiple profiles for separate things, at the moment when spawning into a profile it use the default user pvc, however I want each profile to use a separate PVC with no shared storage between profiles. I have included a snippet of how i’ve configured the profile in the helm chart, but this just doesn’t work -

      profileList:
        - display_name: "profile1"
          description: "desc"
          kubespawner_override:
            start_timeout: 600
            image: image_url_2
            storage_pvc_ensure: true
            pvc_name_template: claim-{username}-profile1
            storage_capacity: 10Gi
            storage_access_modes: 
              - ReadWriteOnce
            lifecycle_hooks:
              postStart:
                exec:
                  command:
                    - "/tmp/startup/start.sh"
        - display_name: "profile2"
          description: "desc"
          kubespawner_override:
            start_timeout: 600
            image: image_url_2
            storage_pvc_ensure: true
            pvc_name_template: claim-{username}-profile2
            storage_capacity: 10Gi
            storage_access_modes: 
              - ReadWriteOnce
            lifecycle_hooks:
              postStart:
                exec:
                  command:
                    - "/tmp/startup/start.sh"

What am i doing wrong?

It looks like you’ve found a bug! I’ve opened

Thanks for raising the github issue, i’ll follow the issue on github

Quick question, would there be a workaround for this in the meantime until this is properly fixed and released?

Overriding get_pvc_manifest seems to work:

hub:
  db:
    type: sqlite-pvc
  extraConfig:
    customkubespawner: |
        from kubespawner import KubeSpawner
        class CustomKubeSpawner(KubeSpawner):
            def get_pvc_manifest(self):
                self.pvc_name = self._expand_user_properties(self.pvc_name_template)
                return super().get_pvc_manifest()
        c.JupyterHub.spawner_class = CustomKubeSpawner

proxy:
  service:
    type: NodePort
    nodePorts:
      http: 31080

singleuser:
  profileList:
    - display_name: "profile1"
      description: "desc1"
      kubespawner_override:
        pvc_name_template: claim-{username}-profile1
    - display_name: "profile2"
      description: "desc2"
      kubespawner_override:
        pvc_name_template: claim-{username}-profile2

debug:
  enabled: true

but I haven’t checked it in depth. Also be aware of the comment on

I think you should be OK if you don’t have existing PVCs created under the old naming scheme but please review the code and check carefully!