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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kubetemplatespawner-0.1.0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kubetemplatespawner-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file kubetemplatespawner-0.1.0.tar.gz.

File metadata

  • Download URL: kubetemplatespawner-0.1.0.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for kubetemplatespawner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9ea7085d1d6743d40fdb1ab9de33314157bd383a2f9a1c17d0366d011fe6ee90
MD5 7ddc4539167b03056ecf04c8376806fe
BLAKE2b-256 e016661cc2e576ea1eee258d40ef26b9dd9a7c80a90e32cabb4daa44d7487a3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kubetemplatespawner-0.1.0.tar.gz:

Publisher: workflow.yml on manics/jupyterhub-kubetemplatespawner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kubetemplatespawner-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kubetemplatespawner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 567c952fd30ca8f35124961df119f8d4b13ae5760003061180317e2e2cb0bbee
MD5 968b22c92f005452057f77c4b3964f1c
BLAKE2b-256 565d6479c342f61cda173c0c5231801152f17738365fc0b871d565bb6408ff0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kubetemplatespawner-0.1.0-py3-none-any.whl:

Publisher: workflow.yml on manics/jupyterhub-kubetemplatespawner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page