Skip to content

Commit 24132a5

Browse files
committed
CH-94 add control on image prepull
1 parent 313b9e4 commit 24132a5

3 files changed

Lines changed: 55 additions & 2 deletions

File tree

applications/jupyterhub/deploy/templates/image-puller/_helpers-daemonset.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,27 @@ spec:
199199
securityContext:
200200
{{- . | toYaml | nindent 12 }}
201201
{{- end }}
202+
{{- end }}
203+
{{- /* --- EDIT: CLOUDHARNESS pull images --- */}}
204+
{{- if $.Values.apps.jupyterhub.harness.jupyterhub.prepull -}}
205+
{{- range $k, $v := $.Values.apps.jupyterhub.harness.jupyterhub.prepull }}
206+
- name: image-pull--{{ $v }}
207+
image: {{ get ( get $.Values "task-images" ) $v }}
208+
command:
209+
- /bin/sh
210+
- -c
211+
- echo "Pulling complete"
212+
{{- with $.Values.apps.jupyterhub.prePuller.resources }}
213+
resources:
214+
{{- . | toYaml | nindent 12 }}
215+
{{- end }}
216+
{{- with $.Values.apps.jupyterhub.prePuller.containerSecurityContext }}
217+
securityContext:
218+
{{- . | toYaml | nindent 12 }}
219+
{{- end }}
202220
{{- end }}
221+
{{- end }}
222+
{{- /* --- END EDIT: CLOUDHARNESS pull images --- */}}
203223
containers:
204224
- name: pause
205225
image: {{ .Values.apps.jupyterhub.prePuller.pause.image.name }}:{{ .Values.apps.jupyterhub.prePuller.pause.image.tag }}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
1+
harness:
2+
jupyterhub:
3+
prepull:
4+
- cloudharness-base
5+

docs/jupyterhub.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Edit the `deploy/values.yaml` file `harness.jupyterhub` section to edit configu
3535
- `applicationHook`: change the hook function (advances, see below)
3636
- `extraConfig`: allows you to add Python snippets to the jupyterhub_config.py file
3737
- `spawnerExtraConfig`: allows you to add values to the spawner object without the need of creating a new hook
38+
- `prepull`: indicate images that will be prepulled from the current build
3839

3940
Example:
4041
```yaml
@@ -46,6 +47,8 @@ harness:
4647
name: proxy-public
4748
jupyterhub:
4849
args: ["--debug", "--NotebookApp.default_url=/lab"]
50+
prepull:
51+
- cloudharness-base
4952
extraConfig:
5053
timing: |
5154
c.Spawner.port = 8000
@@ -179,4 +182,30 @@ Cloudharness JupyterHub is integrated with the accounts service so enabling a sh
179182

180183
The spawner is also adapted providing a hook to allow other applications to be based on the hub spawner to run with their own configurations.
181184

182-
Available
185+
Available
186+
187+
## Prepull configuration
188+
Image prepull can be configured in two ways.
189+
190+
For static images (tag known), can set `prepuller.extraImages` on `applications/jupyterhub/deploy/values.yaml`, like:
191+
192+
```yaml
193+
prePuller:
194+
extraImages:
195+
nginx-image:
196+
name: nginx
197+
tag: latest
198+
```
199+
200+
For images which build is managed by CloudHarness the tag is unknown during the configuration;
201+
for this case, can rely on the dynamic configuration through `harness.jupyterhub.prepull` variable, like:
202+
203+
```yaml
204+
harness:
205+
jupyterhub:
206+
prepull:
207+
- cloudharness-base
208+
```
209+
210+
> Note that only built images defined as tasks, base or common can be used here.
211+
> If an image is not included, it might be required to include it also as a build dependency or, better, define task images directly inside your jupyterhub application override.

0 commit comments

Comments
 (0)