JupyterHub
This document describes the integration of PrimeHub and JupyterHub.
Concept
The whole magic happens in jupyterhub_profiles.py, which customizes the kubespawner. Here is the brief spawner logic
- A user logs in to keycloak and postback the user profile to jupyterhub. (by OIDC flow)
 - Store the authentication data in the cookie.
 - Use the authentication data to query graphql to get the groups, instance types, images, datasets of the logged in user
 - The spawner renders the options in the spawner page
 - The user selects the options they would like to spawn and submits.
 - By kubespawner mechanism, assemble the jupyter pod's spec and spawn this pod.
 

Main Classes
We customize the authenticator and spawner described in the jupyterhub document
| Class | Description | 
|---|---|
| OIDCAuthenticator | Implement GenericOAuthenticator with OIDC integration. It also provides spawner the authentication data of logged in users (in pre_spawn_start()). | 
| PrimeHubSpawner | Implementation Kubespawner with PrimeHub pod spawning logic. |