I want to get body content of API /hub/api/users/user-name/server and do some task regarding copy data to user pod space. I did some R&D and figured out spawner start() method have request body data in self.user_options.
I have override start() function using spawner_class in helm chart under hub.extraConfig and successfully get request body parameters in kubectl logs.
hub:
extraConfig:
myConfig.py: |
import loggingfrom jupyterhub.spawner import LocalProcessSpawner from jupyterhub.spawner import Spawner from kubespawner import KubeSpawner class custom_spawner(KubeSpawner): def start(self): logging.info("=== start triggered!") logging.info(self.user_options) logging.info(self.user.name) return (self.ip, self.user.server.port) c.JupyterHub.spawner_class = custom_spawner
However, user pod failed to start with an error: Spawner failed to start [status=1]. Can someone figure out what’s wrong with this approach.
Is there any better option instead of overriding spawner start() method?