This Python package provides KubeSpawner hooks for customizing a user's server options based on the groups that they belong to.
These hooks are specific to OSG's COmanage infrastructure and the OSPool.
Use pip
to install this package into the same Python environment as
JupyterHub:
python3 -m pip install git+https://github.com/osg-htc/jupyterhub-hooks.git@<ref>
Replace <ref>
with a tag or any other Git ref into this repository.
Via JupyterHub's configuration, configure KubeSpawner
to use the hooks:
from osg.jupyterhub import kubespawner_hooks c.KubeSpawner.auth_state_hook = kubespawner_hooks.auth_state_hook c.KubeSpawner.options_form = kubespawner_hooks.options_form c.KubeSpawner.modify_pod_hook = kubespawner_hooks.modify_pod_hook
The hooks are configured via a YAML file:
/etc/osg/kubespawner_hooks_config.yaml
The structure is determined by the class Configuration
in osg/jupyterhub/kubespawner_hooks.py.
This project uses Poetry to manage its dependencies:
- Install Poetry.
- Run
poetry update
to install dependencies.
The dependencies replicate the environment provided by a particular version
of Z2JH's k8s-hub
image. (Refer to the comments in pyproject.toml.)
This project uses pre-commit to ensure commits meet minimum requirements:
- Run
poetry run pre-commit install
to install the Git hooks.
The Makefile provides reformat
and lint
targets for running
various standard tools (isort
, black
, pylint
, etc.).