Dynamic CPU and Memory through helm chart

I’m currently specifying CPU and memory values through a Helm chart, but I’d like to make these values dynamic. Instead of a dropdown, is it possible to use a text box for entering values dynamically?

singleuser:
  startTimeout: 1200 
  profileList:
    - display_name: Data Science CPU
      description: "Select from the below available images"
      profile_options:
        image:
          display_name: "Image"
          choices:
            pyspark350:
              display_name: "PySpark 3.5.0 + Python 3.11"
              kubespawner_override:
                image: jupyter/base-notebook:python-3.11.5
        cpu_memory:
                display_name: "CPU and Memory"
                choices:
                  ymicro:
                    display_name: "Micro (1 CPU, 2GB Memory)"
                    kubespawner_override:
                      cpu_guarantee: 1
                      mem_guarantee: 2G
                      cpu_limit: 2
                      mem_limit: 2G
                  xmini:
                    display_name: "Mini (1 CPU, 4GB Memory)"
                    kubespawner_override:
                      cpu_guarantee: 1
                      mem_guarantee: 4G
                      cpu_limit: 2
                      mem_limit: 4G
                  small:
                    display_name: " Small (2 CPU, 8GB Memory)"
                    kubespawner_override:
                      cpu_guarantee: 2
                      mem_guarantee: 8G
                      cpu_limit: 4
                      mem_limit: 8G

It should be possible, see the unlisted_choice option:
https://jupyterhub-kubespawner.readthedocs.io/en/latest/spawner.html#kubespawner.KubeSpawner.profile_list

The unlisted_choice option is not operating without choices option and also i am not able to add multiple values.

profileList:
    - display_name: Data Science CPU
      description: "Select from the below available images"
      profile_options:
        image:
          display_name: "Image"
          choices:
            pyspark350:
              display_name: "PySpark 3.5.0 + Python 3.11"
              kubespawner_override:
                image: jupyter/base-notebook:python-3.11.5
        cpu_memory:
                display_name: "CPU and Memory"
                unlisted_choice: 
                    enabled: true
                    display_name: cpu_guarantee
                    kubespawner_override:
                      cpu_guarantee: {value}
                    display_name: mem_guarantee
                    kubespawner_override:
                      mem_guarantee: {value}
                    display_name: cpu_limit
                    kubespawner_override:
                      cpu_limit: {value}
                    display_name: mem_limit
                    kubespawner_override:
                      mem_limit: {value}

                choices:
                  ymicro:
                    display_name: "Micro (1 CPU, 2GB Memory)"
                    kubespawner_override:
                      cpu_guarantee: 1
                      mem_guarantee: 2G
                      cpu_limit: 2
                      mem_limit: 2G
                  xmini:
                    display_name: "Mini (1 CPU, 4GB Memory)"
                    kubespawner_override:
                      cpu_guarantee: 1
                      mem_guarantee: 4G
                      cpu_limit: 2
                      mem_limit: 4G
                  small:
                    display_name: " Small (2 CPU, 8GB Memory)"
                    kubespawner_override:
                      cpu_guarantee: 2
                      mem_guarantee: 8G
                      cpu_limit: 4
                      mem_limit: 8G

You’re right, I’ve created a feature request:

1 Like