Zero-to-jupyterhub-k8s: lifecycle_hooks can not be overridden in "kubespawner_override"

Created on 17 Apr 2019  路  2Comments  路  Source: jupyterhub/zero-to-jupyterhub-k8s

config.yaml singleuser: image: name: jupyter/minimal-notebook tag: 7d427e7a4dde profileList: - display_name: Minimal Python Environment description: "Only the basic notebook" default: true - display_name: Other Environment description: "" kubespawner_override: image: jupyter/r-notebook:latest lifecycleHooks: postStart: exec: command: ["/bin/sh", "-c", "echo Hello from overridden handler > $HOME/message"] lifecycleHooks: postStart: exec: command: ["/bin/sh", "-c", "echo Hello from the postStart handler > $HOME/message"] storage: capacity: 5Gi dynamic: storageClass: nfs-client memory: limit: 8G guarantee: 1G cpu: limit: 4 guarantee: .5
A configuration like this will always call the default lifecycle hook instead of the one in the profile.

documentation

Most helpful comment

Ah... but if you do...

  profileList:
    - display_name: Minimal Python Environment
      description: "Only the basic notebook"
      default: true
    - display_name: Other Environment
      description: ""
      kubespawner_override:
        image:  jupyter/r-notebook:latest
        lifecycle_hooks:
          postStart:
            exec:
              command: ["/bin/sh", "-c", "echo Hello from overridden handler > $HOME/message"]
  lifecycleHooks:
    postStart:
      exec:
        command: ["/bin/sh", "-c", "echo Hello from the postStart handler > $HOME/message"]

Yikes... Ready for a dirty reason why this is the case?

  1. The Z2JH Helm chart syntax for its values (lifecycleHooks)
  2. kubespawner's configuration options (lifecycle_hooks)
  3. Kubernetes pod specifications (postStart).

When you are writing things within kubespawner_override you are writing raw configuration for kubespawner, and must use the snake-case version.

All 2 comments

Ah... but if you do...

  profileList:
    - display_name: Minimal Python Environment
      description: "Only the basic notebook"
      default: true
    - display_name: Other Environment
      description: ""
      kubespawner_override:
        image:  jupyter/r-notebook:latest
        lifecycle_hooks:
          postStart:
            exec:
              command: ["/bin/sh", "-c", "echo Hello from overridden handler > $HOME/message"]
  lifecycleHooks:
    postStart:
      exec:
        command: ["/bin/sh", "-c", "echo Hello from the postStart handler > $HOME/message"]

Yikes... Ready for a dirty reason why this is the case?

  1. The Z2JH Helm chart syntax for its values (lifecycleHooks)
  2. kubespawner's configuration options (lifecycle_hooks)
  3. Kubernetes pod specifications (postStart).

When you are writing things within kubespawner_override you are writing raw configuration for kubespawner, and must use the snake-case version.

@clancychilds thank you so much for documenting this and @mhuttner for reporting this experience!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

consideRatio picture consideRatio  路  4Comments

consideRatio picture consideRatio  路  3Comments

Boes-man picture Boes-man  路  3Comments

aurashn picture aurashn  路  4Comments

jgerardsimcock picture jgerardsimcock  路  4Comments