Skip to main content

KubeTemplateSpawner

Build

⚠️⚠️⚠️⚠️⚠️ Under development ⚠️⚠️⚠️⚠️⚠️

A JupyterHub Kubernetes spawner that uses Kubernetes templates.

How this works

This takes a set of parameterised Helm templates that deploy a JupyterHub singleuser server, then:

  • creates a temporary Helm values.yaml file with JupyterHub template variables
  • runs helm template ...
  • deploys the templated manifests

The following template variables are available

Raw user and server:

  • userid
  • unescaped_username
  • unescaped_servername

Escaped user and server (based on the KubeSpawner safe scheme):

  • escaped_username
  • escaped_servername
  • escaped_user_server

Spawner variables:

  • instance: Instance name to distinguish multiple JupyterHub deployments
  • namespace: Kubernetes namespace
  • ip: IP the server should listen on
  • port Port the server should listen on
  • env: Dictionary of key: value environment variables

Additional variables:

  • Variables from KubeTemplateSpawner.extra_vars are included, and can override the above

Labels

All resources must include an instance label to distinguish multiple deployments:

  • app.kubernetes.io/instance: {{ .Values.instance }}

User resources must include:

  • hub.jupyter.org/username: "{{ .Values.escaped_username }}"

User server resources (that aren't shared between default and named servers) must also include:

  • hub.jupyter.org/servername: "{{ .Values.escaped_servername }}"

Connection annotation:

  • kubetemplatespawner/connection=true: One resource per server (either a pod or service) must have this annotation to indicate JupyterHub should use this resource to connect to the server

Lifecycle/deletion

These control when resources are deleted.

  • kubetemplatespawner/lifecycle=user-deleted: Delete this resource when the user is deleted, typically used for storage volumes
  • kubetemplatespawner/lifecycle=server-stopped: Delete this resource when the user server is stopped, typically the default for most resources other than persistent storage
  • kubetemplatespawner/lifecycle=server-deleted: Delete this resource when a named server is deleted, use this if a named server has a separate storage volume that doesn't need to be kept

Resources are deleted by matching all labels:

  • app.kubernetes.io/instance: {{ .Values.instance }}
  • hub.jupyter.org/username: "{{ .Values.escaped_username }}"
  • hub.jupyter.org/servername: "{{ .Values.escaped_servername }}" (servers only)

Example

https://github.com/manics/jupyterhub-kubetemplatespawner/tree/main/z2jh

Metadata

Release files for kubetemplatespawner 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kubetemplatespawner 0.1.0
File Size Uploaded
kubetemplatespawner-0.1.0.tar.gz 24.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kubetemplatespawner 0.1.0
File Interpreter ABI Platform
kubetemplatespawner-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.9 kB

Release files / kubetemplatespawner-0.1.0.tar.gz

Download URL kubetemplatespawner-0.1.0.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9ea7085d1d6743d40fdb1ab9de33314157bd383a2f9a1c17d0366d011fe6ee90
BLAKE2b-256 checksum
How to use checksums
e016661cc2e576ea1eee258d40ef26b9dd9a7c80a90e32cabb4daa44d7487a3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 21, 2025.

Transparency log

Release files / kubetemplatespawner-0.1.0-py3-none-any.whl

Download URL kubetemplatespawner-0.1.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
567c952fd30ca8f35124961df119f8d4b13ae5760003061180317e2e2cb0bbee
BLAKE2b-256 checksum
How to use checksums
565d6479c342f61cda173c0c5231801152f17738365fc0b871d565bb6408ff0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page