Skip to content

Commit a417772

Browse files
committed
fix(prepuller): Add dummy service accounts to hook-image-puller and continuous-image-puller pods
1 parent b3fb34b commit a417772

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed

jupyterhub/templates/_helpers-names.tpl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,29 @@
196196
{{- include "jupyterhub.fullname.dash" . }}hook-image-puller
197197
{{- end }}
198198

199+
{{- /* hook-image-puller ServiceAccount */}}
200+
{{- define "jupyterhub.hook-image-puller-serviceaccount.fullname" -}}
201+
{{- if .Values.prePuller.hook.serviceAccountImagePuller.create }}
202+
{{- .Values.prePuller.hook.serviceAccountImagePuller.name | default (include "jupyterhub.hook-image-puller.fullname" .) }}
203+
{{- else }}
204+
{{- .Values.prePuller.hook.serviceAccountImagePuller.name | default "default" }}
205+
{{- end }}
206+
{{- end }}
207+
199208
{{- /* continuous-image-puller DaemonSet */}}
200209
{{- define "jupyterhub.continuous-image-puller.fullname" -}}
201210
{{- include "jupyterhub.fullname.dash" . }}continuous-image-puller
202211
{{- end }}
203212

213+
{{- /* continuous-image-puller ServiceAccount */}}
214+
{{- define "jupyterhub.continuous-image-puller-serviceaccount.fullname" -}}
215+
{{- if .Values.prePuller.continuous.serviceAccount.create }}
216+
{{- .Values.prePuller.continuous.serviceAccount.name | default (include "jupyterhub.continuous-image-puller.fullname" .) }}
217+
{{- else }}
218+
{{- .Values.prePuller.continuous.serviceAccount.name | default "default" }}
219+
{{- end }}
220+
{{- end }}
221+
204222
{{- /* singleuser NetworkPolicy */}}
205223
{{- define "jupyterhub.singleuser.fullname" -}}
206224
{{- include "jupyterhub.fullname.dash" . }}singleuser

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ spec:
7070
{{- include "jupyterhub.userNodeAffinityRequired" . | nindent 14 }}
7171
{{- end }}
7272
terminationGracePeriodSeconds: 0
73+
{{- if .hook }}
74+
{{- with include "jupyterhub.hook-image-puller-serviceaccount.fullname" . }}
75+
serviceAccountName: {{ . }}
76+
{{- end }}
77+
{{- else }}
78+
{{- with include "jupyterhub.continuous-image-puller-serviceaccount.fullname" . }}
79+
serviceAccountName: {{ . }}
80+
{{- end }}
81+
{{- end }}
7382
automountServiceAccountToken: false
7483
{{- with include "jupyterhub.imagePullSecrets" (dict "root" . "image" .Values.singleuser.image) }}
7584
imagePullSecrets: {{ . }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- /*
2+
ServiceAccount for the continuous image-puller daemonset
3+
*/}}
4+
{{- if .Values.prePuller.continuous.serviceAccount.create -}}
5+
{{- if .Values.prePuller.continuous.enabled -}}
6+
apiVersion: v1
7+
kind: ServiceAccount
8+
metadata:
9+
name: {{ include "jupyterhub.continuous-image-puller.fullname" . }}
10+
labels:
11+
{{- include "jupyterhub.labels" . | nindent 4 }}
12+
annotations:
13+
{{- with .Values.prePuller.continuous.serviceAccount.annotations }}
14+
{{- . | toYaml | nindent 4 }}
15+
{{- end }}
16+
{{- end }}
17+
{{- end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- /*
2+
ServiceAccount for the hook image-puller daemonset
3+
*/}}
4+
{{- if .Values.prePuller.hook.serviceAccountImagePuller.create -}}
5+
{{- if (include "jupyterhub.imagePuller.daemonset.hook.install" .) -}}
6+
apiVersion: v1
7+
kind: ServiceAccount
8+
metadata:
9+
name: {{ include "jupyterhub.hook-image-puller-serviceaccount.fullname" . }}
10+
labels:
11+
{{- include "jupyterhub.labels" . | nindent 4 }}
12+
hub.jupyter.org/deletable: "true"
13+
annotations:
14+
"helm.sh/hook": pre-install,pre-upgrade
15+
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
16+
"helm.sh/hook-weight": "0"
17+
{{- with .Values.prePuller.hook.serviceAccountImagePuller.annotations }}
18+
{{- . | toYaml | nindent 4 }}
19+
{{- end }}
20+
{{- end }}
21+
{{- end }}

jupyterhub/values.schema.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,6 +2864,7 @@ properties:
28642864
image: *image-spec
28652865
resources: *resources-spec
28662866
serviceAccount: *serviceAccount
2867+
serviceAccountImagePuller: *serviceAccount
28672868
continuous:
28682869
type: object
28692870
additionalProperties: false
@@ -2880,6 +2881,7 @@ properties:
28802881
properties:
28812882
enabled:
28822883
type: boolean
2884+
serviceAccount: *serviceAccount
28832885
pullProfileListImages:
28842886
type: boolean
28852887
description: |

jupyterhub/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,22 @@ prePuller:
665665
nodeSelector: {}
666666
tolerations: []
667667
resources: {}
668+
# Service Account for the hook-image-awaiter Job
668669
serviceAccount:
669670
create: true
670671
name:
671672
annotations: {}
673+
# Service Account for the hook-image-puller DaemonSet
674+
serviceAccountImagePuller:
675+
create: true
676+
name:
677+
annotations: {}
672678
continuous:
673679
enabled: true
680+
serviceAccount:
681+
create: true
682+
name:
683+
annotations: {}
674684
pullProfileListImages: true
675685
extraImages: {}
676686
pause:

0 commit comments

Comments
 (0)