Skip to content

Commit d94c113

Browse files
authored
Merge pull request #3594 from samyuh/ft-labels-hub
Add dummy service accounts to hook-image-puller and continuous-image-puller pods
2 parents 5ad350e + 6ffc084 commit d94c113

File tree

7 files changed

+73
-0
lines changed

7 files changed

+73
-0
lines changed

jupyterhub/templates/_helpers-names.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,21 @@
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+
{{- .Values.prePuller.hook.serviceAccountImagePuller.name | default (include "jupyterhub.hook-image-puller.fullname" .) }}
202+
{{- end }}
203+
199204
{{- /* continuous-image-puller DaemonSet */}}
200205
{{- define "jupyterhub.continuous-image-puller.fullname" -}}
201206
{{- include "jupyterhub.fullname.dash" . }}continuous-image-puller
202207
{{- end }}
203208

209+
{{- /* continuous-image-puller ServiceAccount */}}
210+
{{- define "jupyterhub.continuous-image-puller-serviceaccount.fullname" -}}
211+
{{- .Values.prePuller.continuous.serviceAccount.name | default (include "jupyterhub.continuous-image-puller.fullname" .) }}
212+
{{- end }}
213+
204214
{{- /* singleuser NetworkPolicy */}}
205215
{{- define "jupyterhub.singleuser.fullname" -}}
206216
{{- include "jupyterhub.fullname.dash" . }}singleuser
@@ -298,7 +308,9 @@ image-puller-priority: {{ include "jupyterhub.image-puller-priority.fullname" .
298308
hook-image-awaiter: {{ include "jupyterhub.hook-image-awaiter.fullname" . | quote }}
299309
hook-image-awaiter-serviceaccount: {{ include "jupyterhub.hook-image-awaiter-serviceaccount.fullname" . | quote }}
300310
hook-image-puller: {{ include "jupyterhub.hook-image-puller.fullname" . | quote }}
311+
hook-image-puller-serviceaccount: {{ include "jupyterhub.hook-image-puller-serviceaccount.fullname" . | quote }}
301312
continuous-image-puller: {{ include "jupyterhub.continuous-image-puller.fullname" . | quote }}
313+
continuous-image-puller-serviceaccount: {{ include "jupyterhub.continuous-image-puller-serviceaccount.fullname" . | quote }}
302314
singleuser: {{ include "jupyterhub.singleuser.fullname" . | quote }}
303315
image-pull-secret: {{ include "jupyterhub.image-pull-secret.fullname" . | quote }}
304316
ingress: {{ include "jupyterhub.ingress.fullname" . | quote }}

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": "-10"
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:

tools/templates/lint-and-validate-values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,10 @@ prePuller:
563563
value: mock-taint-value-hook
564564
effect: NoSchedule
565565
serviceAccount: *serviceAccount
566+
serviceAccountImagePuller: *serviceAccount
566567
continuous:
567568
enabled: true
569+
serviceAccount: *serviceAccount
568570
extraImages:
569571
mockImage1:
570572
name: mock-user/mock-image1

0 commit comments

Comments
 (0)