Hello,
I am trying to use the pre_spawn_hook of the KubeSpawner.
My ultimate goal is to add volumes and auth info.
Following different examples I’ve seen in this forum, I actually can’t see the hook being executed at all anywhere.
So I went very basic and have this code, for which I would expect some logs in the hub pod logs.
singleuser:
profileList:
- display_name: "test"
kubespawner_override:
extraConfig:
00-volumes: |
def preSpawnHook(spawner):
print("preSpawnHook for mounting volume\n")
print("hook - 00-volume")
c.KubeSpawner.pre_spawn_hook = preSpawnHook
Those 2 print statements never show up in the hub pod logs.
The override appears to be read properly by the hub, as stated in the hub logs when the single user pod is starting.
[D 2023-02-14 23:47:05.232 JupyterHub spawner:2989] .. overriding KubeSpawner value extraConfig={'00-volumes': 'def preSpawnHook(spawner): \n print("preSpawnHook for mounting volume\\n")\nprint("hook - 00-volume")\nc.KubeSpawner.pre_spawn_hook = preSpawnHook\n'}
I have 2 questions:
- anything else I need to do to “activate” the hook?
- is there a better way to debug this than the print statement and pod logs?
I am using the version 2.0.0 of the helm chart of jupyterhub