Skip to content

Commit

Permalink
Merge pull request #3594 from samyuh/ft-labels-hub
Browse files Browse the repository at this point in the history
Add dummy service accounts to hook-image-puller and continuous-image-puller pods
  • Loading branch information
consideRatio authored Jan 12, 2025
2 parents 5ad350e + 6ffc084 commit d94c113
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 0 deletions.
12 changes: 12 additions & 0 deletions jupyterhub/templates/_helpers-names.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,21 @@
{{- include "jupyterhub.fullname.dash" . }}hook-image-puller
{{- end }}

{{- /* hook-image-puller ServiceAccount */}}
{{- define "jupyterhub.hook-image-puller-serviceaccount.fullname" -}}
{{- .Values.prePuller.hook.serviceAccountImagePuller.name | default (include "jupyterhub.hook-image-puller.fullname" .) }}
{{- end }}

{{- /* continuous-image-puller DaemonSet */}}
{{- define "jupyterhub.continuous-image-puller.fullname" -}}
{{- include "jupyterhub.fullname.dash" . }}continuous-image-puller
{{- end }}

{{- /* continuous-image-puller ServiceAccount */}}
{{- define "jupyterhub.continuous-image-puller-serviceaccount.fullname" -}}
{{- .Values.prePuller.continuous.serviceAccount.name | default (include "jupyterhub.continuous-image-puller.fullname" .) }}
{{- end }}

{{- /* singleuser NetworkPolicy */}}
{{- define "jupyterhub.singleuser.fullname" -}}
{{- include "jupyterhub.fullname.dash" . }}singleuser
Expand Down Expand Up @@ -298,7 +308,9 @@ image-puller-priority: {{ include "jupyterhub.image-puller-priority.fullname" .
hook-image-awaiter: {{ include "jupyterhub.hook-image-awaiter.fullname" . | quote }}
hook-image-awaiter-serviceaccount: {{ include "jupyterhub.hook-image-awaiter-serviceaccount.fullname" . | quote }}
hook-image-puller: {{ include "jupyterhub.hook-image-puller.fullname" . | quote }}
hook-image-puller-serviceaccount: {{ include "jupyterhub.hook-image-puller-serviceaccount.fullname" . | quote }}
continuous-image-puller: {{ include "jupyterhub.continuous-image-puller.fullname" . | quote }}
continuous-image-puller-serviceaccount: {{ include "jupyterhub.continuous-image-puller-serviceaccount.fullname" . | quote }}
singleuser: {{ include "jupyterhub.singleuser.fullname" . | quote }}
image-pull-secret: {{ include "jupyterhub.image-pull-secret.fullname" . | quote }}
ingress: {{ include "jupyterhub.ingress.fullname" . | quote }}
Expand Down
9 changes: 9 additions & 0 deletions jupyterhub/templates/image-puller/_helpers-daemonset.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ spec:
{{- include "jupyterhub.userNodeAffinityRequired" . | nindent 14 }}
{{- end }}
terminationGracePeriodSeconds: 0
{{- if .hook }}
{{- with include "jupyterhub.hook-image-puller-serviceaccount.fullname" . }}
serviceAccountName: {{ . }}
{{- end }}
{{- else }}
{{- with include "jupyterhub.continuous-image-puller-serviceaccount.fullname" . }}
serviceAccountName: {{ . }}
{{- end }}
{{- end }}
automountServiceAccountToken: false
{{- with include "jupyterhub.imagePullSecrets" (dict "root" . "image" .Values.singleuser.image) }}
imagePullSecrets: {{ . }}
Expand Down
17 changes: 17 additions & 0 deletions jupyterhub/templates/image-puller/serviceaccount-continuous.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- /*
ServiceAccount for the continuous image-puller daemonset
*/}}
{{- if .Values.prePuller.continuous.serviceAccount.create -}}
{{- if .Values.prePuller.continuous.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.continuous-image-puller.fullname" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
annotations:
{{- with .Values.prePuller.continuous.serviceAccount.annotations }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
21 changes: 21 additions & 0 deletions jupyterhub/templates/image-puller/serviceaccount-hook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- /*
ServiceAccount for the hook image-puller daemonset
*/}}
{{- if .Values.prePuller.hook.serviceAccountImagePuller.create -}}
{{- if (include "jupyterhub.imagePuller.daemonset.hook.install" .) -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.hook-image-puller-serviceaccount.fullname" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "-10"
{{- with .Values.prePuller.hook.serviceAccountImagePuller.annotations }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions jupyterhub/values.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,7 @@ properties:
image: *image-spec
resources: *resources-spec
serviceAccount: *serviceAccount
serviceAccountImagePuller: *serviceAccount
continuous:
type: object
additionalProperties: false
Expand All @@ -2880,6 +2881,7 @@ properties:
properties:
enabled:
type: boolean
serviceAccount: *serviceAccount
pullProfileListImages:
type: boolean
description: |
Expand Down
10 changes: 10 additions & 0 deletions jupyterhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,22 @@ prePuller:
nodeSelector: {}
tolerations: []
resources: {}
# Service Account for the hook-image-awaiter Job
serviceAccount:
create: true
name:
annotations: {}
# Service Account for the hook-image-puller DaemonSet
serviceAccountImagePuller:
create: true
name:
annotations: {}
continuous:
enabled: true
serviceAccount:
create: true
name:
annotations: {}
pullProfileListImages: true
extraImages: {}
pause:
Expand Down
2 changes: 2 additions & 0 deletions tools/templates/lint-and-validate-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,10 @@ prePuller:
value: mock-taint-value-hook
effect: NoSchedule
serviceAccount: *serviceAccount
serviceAccountImagePuller: *serviceAccount
continuous:
enabled: true
serviceAccount: *serviceAccount
extraImages:
mockImage1:
name: mock-user/mock-image1
Expand Down

0 comments on commit d94c113

Please sign in to comment.