aup-learning-cloud icon indicating copy to clipboard operation
aup-learning-cloud copied to clipboard

Migration Guide: Upgrading from legacy jupyterhub_config.py to values.yaml

Open MioYuuIH opened this issue 8 months ago • 0 comments

Overview

The platform has been significantly refactored. The biggest change: all configuration that previously lived in jupyterhub_config.py (a 1700+ line Python file users had to edit manually) has moved into values.yaml.

This means:

  • No more editing Python files to change images, resources, team permissions, or OAuth settings
  • All configuration is now Helm values — override with your own values.local.yaml
  • The Hub Docker image contains all the logic; ConfigMaps contain only YAML data

This guide covers the most common migration scenarios.


1. Authentication

Before — edit jupyterhub_config.py:

AUTH_MODE = "github"  # or "auto-login", "dummy", "multi"
c.GitHubOAuthenticator.oauth_callback_url = "https://example.com/hub/github/oauth_callback"
c.GitHubOAuthenticator.client_id = "..."
c.GitHubOAuthenticator.client_secret = "..."
c.GitHubOAuthenticator.allowed_organizations = {"your-org"}

After — set in values.yaml:

custom:
  authMode: "github"  # auto-login | dummy | github | multi

hub:
  config:
    Authenticator:
      allow_all: true
    GitHubOAuthenticator:
      oauth_callback_url: "https://example.com/hub/github/oauth_callback"
      client_id: "..."
      client_secret: "..."
      allowed_organizations:
        - your-org
      scope:
        - read:user
        - read:org

2. Course Images and Resource Requirements

Before — edit jupyterhub_config.py:

RESOURCE_IMAGES = {
    "cpu": "ghcr.io/amdresearch/auplc-default:latest",
    "Course-CV": "ghcr.io/amdresearch/auplc-cv:latest",
    "Course-DL": "ghcr.io/amdresearch/auplc-dl:latest",
    "Course-LLM": "ghcr.io/amdresearch/auplc-llm:latest",
}

RESOURCE_REQUIREMENTS = {
    "cpu": {"cpu": "2", "memory": "4Gi", "memory_limit": "6Gi"},
    "Course-CV": {"cpu": "4", "memory": "16Gi", "memory_limit": "24Gi", "amd.com/gpu": "1"},
}

TEAM_RESOURCE_MAPPING = {
    "cpu": ["cpu"],
    "gpu": ["Course-CV", "Course-DL", "Course-LLM"],
}

After — set in values.yaml:

custom:
  resources:
    images:
      cpu: "ghcr.io/amdresearch/auplc-default:latest"
      Course-CV: "ghcr.io/amdresearch/auplc-cv:latest"
      Course-DL: "ghcr.io/amdresearch/auplc-dl:latest"
      Course-LLM: "ghcr.io/amdresearch/auplc-llm:latest"

    requirements:
      cpu:
        cpu: "2"
        memory: "4Gi"
        memory_limit: "6Gi"
      Course-CV:
        cpu: "4"
        memory: "16Gi"
        memory_limit: "24Gi"
        amd.com/gpu: "1"

    metadata:
      Course-CV:
        group: "COURSE"
        description: "Computer Vision Course"
        subDescription: "Suitable for CV experiments with GPU"
        accelerator: "GPU"
        acceleratorKeys:
          - strix-halo

  teams:
    mapping:
      cpu:
        - cpu
      gpu:
        - Course-CV
        - Course-DL
        - Course-LLM

3. GPU / Accelerator Configuration

Before — edit jupyterhub_config.py:

NODE_SELECTOR_MAPPING = {
    "strix-halo": {"node-type": "strix-halo"},
    "dgpu": {"node-type": "dgpu"},
}
ENVIRONMENT_MAPPING = {
    "phx": {"HSA_OVERRIDE_GFX_VERSION": "11.0.0"},
    "strix-halo": {},
}

After — set in values.yaml:

custom:
  accelerators:
    phx:
      displayName: "AMD Radeon™ 780M (Phoenix Point iGPU)"
      description: "RDNA 3.0 (gfx1103) | 12 CUs | 4GB LPDDR5X"
      nodeSelector:
        node-type: phx
      env:
        HSA_OVERRIDE_GFX_VERSION: "11.0.0"
      quotaRate: 2
    strix-halo:
      displayName: "AMD Radeon™ 8060S (Strix Halo iGPU)"
      description: "RDNA 3.5 (gfx1151) | 40 CUs | 64GB LPDDR5X"
      nodeSelector:
        node-type: strix-halo
      env: {}
      quotaRate: 3

Per-accelerator image and env overrides

imageOverrides and envOverrides have been replaced by acceleratorOverrides:

Before:

# imageOverrides / envOverrides — no longer supported

After:

custom:
  resources:
    metadata:
      Course-CV:
        acceleratorKeys:
          - strix-halo
          - dgpu
        acceleratorOverrides:
          dgpu:
            image: "ghcr.io/amdresearch/auplc-cv:v1.0-gfx120X"
            env:
              HSA_OVERRIDE_GFX_VERSION: "12.0.0"

4. Storage

Before — edit jupyterhub_config.py:

c.KubeSpawner.storage_class = "nfs-client"
c.KubeSpawner.storage_capacity = "10Gi"

After — set in values.yaml:

singleuser:
  storage:
    capacity: 10Gi
    dynamic:
      storageClass: nfs-client

hub:
  db:
    pvc:
      storageClassName: nfs-client

5. Proxy and Networking

Before — typically set via Helm or partially in config.

After — fully in values.yaml:

proxy:
  service:
    type: NodePort       # or LoadBalancer
    nodePorts:
      http: 30890
  https:
    enabled: true
    type: letsencrypt    # or manual

ingress:
  enabled: true          # set to true if using traefik/nginx ingress
  annotations:
    kubernetes.io/ingress.class: traefik
  hosts:
    - your-domain.com
  tls:
    - secretName: your-tls-secret
      hosts:
        - your-domain.com

6. Git Clone / Private Repo Access

This is a new feature not available in the old version:

custom:
  gitClone:
    githubAppName: ""        # GitHub App slug (for GitHub OAuth users)
    defaultAccessToken: ""   # Bot PAT (works for all auth modes)
    allowedProviders:
      - github.com
      - gitlab.com
      - bitbucket.org
    maxCloneTimeout: 300
    initContainerImage: "alpine/git:2.47.2"

7. Quota System

New feature, disabled by default:

custom:
  quota:
    enabled: true
    cpuRate: 1
    minimumToStart: 10
    defaultQuota: 0
    refreshRules: {}

8. Helm Upgrade Command

Always use both values.yaml (shared base) and your own overlay file:

helm upgrade jupyterhub ./chart --namespace jupyterhub \
  -f runtime/values.yaml \
  -f runtime/values.local.yaml \
  --set prePuller.hook.enabled=false \
  --timeout 5m

After upgrading, restart the Hub pod:

kubectl delete pod -n jupyterhub -l component=hub

Migration Checklist

  • [ ] Move auth config out of jupyterhub_config.py into hub.config.GitHubOAuthenticator
  • [ ] Move resource images into custom.resources.images
  • [ ] Move resource requirements into custom.resources.requirements
  • [ ] Move team/group access rules into custom.teams.mapping
  • [ ] Move node selector mappings into custom.accelerators
  • [ ] Replace imageOverrides/envOverrides with acceleratorOverrides
  • [ ] Update storage class references
  • [ ] Update proxy/ingress configuration
  • [ ] Update Hub image name (see below)
  • [ ] Run helm upgrade with both values files
  • [ ] Restart Hub pod

Hub Image Name

Old New
aup-jupyterhub-hub:* ghcr.io/amdresearch/auplc-hub:latest

If you have questions or run into issues during migration, comment here.

MioYuuIH avatar Mar 13 '26 08:03 MioYuuIH