Skip to content

feat(profiles): auto-inject GPU jupyterlab image for gpu: true profiles - #237

Open
tylerpotts wants to merge 2 commits into
mainfrom
feat/gpu-profile-image-230
Open

feat(profiles): auto-inject GPU jupyterlab image for gpu: true profiles#237
tylerpotts wants to merge 2 commits into
mainfrom
feat/gpu-profile-image-230

Conversation

@tylerpotts

Copy link
Copy Markdown
Contributor

What

Closes #230

Profiles in jupyterhub.custom.profiles can now be marked gpu: true:

- slug: gpu
  display_name: "GPU Access"
  gpu: true
  access: yaml
  groups: [gpu-access]
  kubespawner_override:
    # no image needed — the -gpu image is injected automatically
    node_selector: {node.kubernetes.io/instance-type: g4dn.xlarge}
    extra_resource_limits: {nvidia.com/gpu: 1}

At hub startup, 01-spawner.py injects kubespawner_override.image with the chart-derived GPU image, so GPU profiles track pack updates exactly like CPU profiles instead of pinning a -gpu SHA in the deployer overlay.

How

  • Both jupyterlab images are built by the same build-images.yaml run from the same commit, so they always share the same sha-<short> tag. The chart derives the GPU ref as <singleuser.image.name>-gpu:<singleuser.image.tag> via a new gpuJupyterlabImage helper, exposed through _CHART_DERIVED as gpu-image (same pattern as nebi-image).
  • _resolve_gpu_profiles() in 01-spawner.py runs once at load: injects the image when none is set, leaves an explicit kubespawner_override.image alone, and always strips the gpu key before KubeSpawner sees it.
  • Deployers can override the injected ref chart-wide via jupyterhub.custom.gpu-image.
  • scripts/bump_image_tags.py already bumps singleuser.image.tag each release, so the derived GPU ref stays current with zero script changes.

Testing

  • tests/unit/test_spawner_profiles.py: injection, explicit-image precedence, gpu-key stripping, empty-derived-image fallback, input non-mutation, load-time wiring (7 new tests).
  • tests/unit/test_chart_derived.py: rendered _CHART_DERIVED contains the derived gpu-image; explicit override wins (2 new tests).
  • Full unit suite: 137 passed. helm lint / helm template (incl. --set nebariapp.enabled=false as CI does) and ruff check config/ clean.

Docs

  • docs/src/content/docs/server-profiles.md: new "The GPU image, without hardcoding a SHA" section.
  • docs/src/content/docs/values-reference.md: gpu-image row.
  • values.yaml: gpu-image placeholder + updated GPU profile example.

Profiles marked gpu: true in jupyterhub.custom.profiles get
kubespawner_override.image set to the chart-derived GPU image
(<singleuser.image.name>-gpu:<singleuser.image.tag>) unless an explicit
image is present. Both jupyterlab images are built from the same commit
with the same sha tag, so GPU profiles now track pack updates
automatically instead of pinning a -gpu SHA in the deployer overlay.

Deployers can override the injected ref chart-wide via
jupyterhub.custom.gpu-image. The gpu key is stripped before profiles
reach KubeSpawner.

Closes #230
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview for feat/gpu-profile-image-230:
https://feat-gpu-profile-image-230.data-science-pack.pages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] - Pull GPU-compatible Images for Lab profiles without hardcoding a SHA in pack config

2 participants