From 1f16dd026d81678d29ff036b8fd5bd8d73539835 Mon Sep 17 00:00:00 2001 From: Andrii Salnikov Date: Mon, 11 Sep 2023 15:40:28 +0200 Subject: [PATCH 1/4] profile_options support for prePulling profile images --- .../image-puller/_helpers-daemonset.tpl | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/jupyterhub/templates/image-puller/_helpers-daemonset.tpl b/jupyterhub/templates/image-puller/_helpers-daemonset.tpl index 1fe8276e3e..610f8bde92 100644 --- a/jupyterhub/templates/image-puller/_helpers-daemonset.tpl +++ b/jupyterhub/templates/image-puller/_helpers-daemonset.tpl @@ -134,6 +134,7 @@ spec: {{- /* --- Conditionally pull profileList images --- */}} {{- if .Values.prePuller.pullProfileListImages }} {{- range $k, $container := .Values.singleuser.profileList }} + {{- /* profile's kubespawner_override */}} {{- if $container.kubespawner_override }} {{- if $container.kubespawner_override.image }} - name: image-pull-singleuser-profilelist-{{ $k }} @@ -152,6 +153,33 @@ spec: {{- end }} {{- end }} {{- end }} + {{- /* kubespawner_override in profile's profile_options */}} + {{- if $container.profile_options }} + {{- range $option, $option_spec := $container.profile_options }} + {{- if $option_spec.choices }} + {{- range $choice, $choice_spec := $option_spec.choices }} + {{- if $choice_spec.kubespawner_override }} + {{- if $choice_spec.kubespawner_override.image }} + - name: image-pull-profile-{{ $k }}-option-{{ $option }}-{{ $choice }} + image: {{ $choice_spec.kubespawner_override.image }} + command: + - /bin/sh + - -c + - echo "Pulling complete" + {{- with $.Values.prePuller.resources }} + resources: + {{- . | toYaml | nindent 12 }} + {{- end }} + {{- with $.Values.prePuller.containerSecurityContext }} + securityContext: + {{- . | toYaml | nindent 12 }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} {{- end }} {{- end }} From e7ce26ed456b77f998a9f74e3351dab2f4f1bc53 Mon Sep 17 00:00:00 2001 From: Andrii Salnikov Date: Wed, 25 Oct 2023 23:26:43 +0200 Subject: [PATCH 2/4] add profile with profile_options to lint-and-validate values --- tools/templates/lint-and-validate-values.yaml | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/templates/lint-and-validate-values.yaml b/tools/templates/lint-and-validate-values.yaml index 0db90333c7..0507edf346 100644 --- a/tools/templates/lint-and-validate-values.yaml +++ b/tools/templates/lint-and-validate-values.yaml @@ -344,7 +344,27 @@ singleuser: mock description 2 kubespawner_override: image: XYZ:XYZ - nodeSelector: + - display_name: "mock display name 3" + description: | + mock description 3 + profile_options: + image: + display_name: Image + choices: + image1: + display_name: "image 1" + kubespawner_override: + image: XXX:XXX + image2: + display_name: "image 2" + kubespawner_override: + image: YYY:YYY + unlisted_choice: + enabled: true + display_name: "image ZZZ tag" + kubespawner_override: + image: "ZZZ:{value}" + nodeSelector: mock-node-selector: mock extraTolerations: - effect: NoSchedule From d6569c932b43b9f28cc6823799f7dc4ae36fbfc2 Mon Sep 17 00:00:00 2001 From: Andrii Salnikov Date: Wed, 25 Oct 2023 23:31:37 +0200 Subject: [PATCH 3/4] add profile with profile_options to lint-and-validate values (fix typo) --- tools/templates/lint-and-validate-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/templates/lint-and-validate-values.yaml b/tools/templates/lint-and-validate-values.yaml index 0507edf346..69d7b4534d 100644 --- a/tools/templates/lint-and-validate-values.yaml +++ b/tools/templates/lint-and-validate-values.yaml @@ -364,7 +364,7 @@ singleuser: display_name: "image ZZZ tag" kubespawner_override: image: "ZZZ:{value}" - nodeSelector: + nodeSelector: mock-node-selector: mock extraTolerations: - effect: NoSchedule From fe43c02f6fbd5165e8e64f9a04e1f67017e50b3c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 23 Nov 2023 12:54:20 +0100 Subject: [PATCH 4/4] docs: note that images under profile_options are pulled also --- docs/source/conf.py | 1 + jupyterhub/values.schema.yaml | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index c2ce1a2196..3a05d33dc1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -175,6 +175,7 @@ def parse_schema(d, md=[], depth=0, pre=""): intersphinx_mapping = { "jupyterhub": ("https://jupyterhub.readthedocs.io/en/stable/", None), "oauthenticator": ("https://oauthenticator.readthedocs.io/en/stable/", None), + "kubespawner": ("https://jupyterhub-kubespawner.readthedocs.io/en/stable/", None), } # intersphinx_disabled_reftypes set based on recommendation in diff --git a/jupyterhub/values.schema.yaml b/jupyterhub/values.schema.yaml index 6f9dd314ff..69c13a83c0 100644 --- a/jupyterhub/values.schema.yaml +++ b/jupyterhub/values.schema.yaml @@ -2850,9 +2850,12 @@ properties: pullProfileListImages: type: boolean description: | - The singleuser.profileList configuration can let the user choose an - image through the selection of a profile. This option determines if - those images will be pulled, both by the hook and continuous pullers. + The singleuser.profileList configuration can provide a selection of + images. This option determines if all images identified there should + be pulled, both by the hook and continuous pullers. + + Images are looked for under `kubespawner_override`, and also + `profile_options.choices.kubespawner_override` since version 3.2.0. The reason to disable this, is that if you have for example 10 images which start pulling in order from 1 to 10, a user that arrives and