I use the pre_spawn_hook capability to get the selected user profile in the KubeSpawner.
that’s the function call I do
spawner.user_options.get("profile", "")
I only see the capability of getting a somewhat modified version of the display_name of the profile, and not any other attributes that could be dedicated only to programming and not display, something that would be more predictable.
For instance if the profile display_name is something like “This is the super profile / production”
it ends being something like “this-is-the-super-profile-production” I believe. Which is nice but not predictable and IMHO how it’s called on the UI shouldn’t be a concern for the rest of the code.
Did I miss other profile attributes that could be used here?
singleuser:
profileList:
- display_name: "Default: Shared, 8 CPU cores"
description: "Your code will run on a shared machine with CPU only."
slug: "default"
default: True
- display_name: "Personal, 4 CPU cores & 26GB RAM, 1 NVIDIA Tesla K80 GPU"
slug: "gpu"
description: "Your code will run a personal machine with a GPU."
kubespawner_override:
extra_resource_limits:
nvidia.com/gpu: "1"
thanks for the example. That’s perfect. That’s what I’ll do indeed.
I meant that it should probably be useful if it’s in the doc and the global values.yaml file that contains all the options for the chart.
I’ll propose a simple PR.
profile_list c.KubeSpawner.profile_list = Union()
List of profiles to offer for selection by the user.
Signature is: List(Dict()), where each item is a dictionary that has two keys:
display_name: the human readable display name (should be HTML safe)
slug: the machine readable slug to identify the profile (missing slugs are generated from display_name)