Is it possible to have a whitelist on profileList for each user?

Hi!

I would like to know if we can define a white list (or with other option/method) to separate, for example, users with GPU access & users with CPU access profiles.

profileList:
- display_name: “Small: 1 CPUs”
description: |
A small job. 1 CPUs, no GPU, and 1GB of RAM
kubespawner_override:
image: docker-registry:443/org/jupyter-cpu:latest
tag: latest
cpu_limit: 1
cpu_guarantee: 1
- display_name: “Small: 1 GPU”
description: |
1 GPU, and 1GB of RAM
kubespawner_override:
image: docker-registry:443/org/jupyter-gpu:latest
tag: latest
cpu_limit: 1
cpu_guarantee: 1
extra_resource_limits:
nvidia.com/gpu: “1”

thanks in advance!

After writing out a whole involved idea on how to roll your own, I rechecked some documentation and you can actually do this pretty easily!

Kubespawner’s profile_list supports a function that takes a spawner object so, assuming you use something like auth_state or other similarly user-attached data, simply process it in your custom profile_list function. You just need to call spawner.user.get.auth_state() to load the user’s auth_state dict in your function.

2 Likes

Thanks a lot vilhelmen!

That is exactly that we want :slight_smile: