Skip to content

Commit

Permalink
Merge pull request #854 from consideRatio/image-puller-robustness
Browse files Browse the repository at this point in the history
No more duplicates of puller pods
  • Loading branch information
minrk authored Aug 18, 2018
2 parents 8dd3753 + 165b7c3 commit 9731556
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion jupyterhub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ sources:
- https://github.com/jupyterhub/zero-to-jupyterhub-k8s
icon: https://jupyter.org/assets/hublogo.svg
kubeVersion: '>=1.8.0-0'
tillerVersion: '>=2.7.0-0'
tillerVersion: '>=2.9.1-0'
7 changes: 3 additions & 4 deletions jupyterhub/templates/image-puller/_daemonset-helper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Returns an image-puller daemonset. Two daemonsets will be created like this.
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
{{- $label := print "-" .Release.Time.Seconds }}
name: {{ print .componentPrefix "image-puller" }}{{- if .hook }}{{ $label }}{{- end }}
name: {{ print .componentPrefix "image-puller" }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- if .hook }}
Expand All @@ -20,7 +19,7 @@ metadata:
Allows the daemonset to be deleted when the image-awaiter job is completed.
*/}}
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "-10"
{{- end }}
spec:
Expand All @@ -34,7 +33,7 @@ spec:
template:
metadata:
labels:
{{- /* Changes here will cause the Deployment to restart the pods. */}}
{{- /* Changes here will cause the DaemonSet to restart the pods. */}}
{{- include "jupyterhub.matchLabels" . | nindent 8 }}
spec:
terminationGracePeriodSeconds: 0
Expand Down
10 changes: 5 additions & 5 deletions jupyterhub/templates/image-puller/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ command.
apiVersion: batch/v1
kind: Job
metadata:
name: hook-image-awaiter-{{ .Release.Time.Seconds }}
name: hook-image-awaiter
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "10"
spec:
template:
metadata:
labels:
{{- /* Changes here will cause the Deployment to restart the pods. */}}
{{- /* Changes here will cause the Job to restart the pods. */}}
{{- include "jupyterhub.matchLabels" . | nindent 8 }}
spec:
restartPolicy: Never
{{- if .Values.rbac.enabled }}
serviceAccountName: hook-image-awaiter-{{ .Release.Time.Seconds }}
serviceAccountName: hook-image-awaiter
{{- end }}
containers:
- image: {{ .Values.prePuller.hook.image.name }}:{{ .Values.prePuller.hook.image.tag }}
Expand All @@ -38,5 +38,5 @@ spec:
- -auth-token-path=/var/run/secrets/kubernetes.io/serviceaccount/token
- -api-server-address=https://$(KUBERNETES_SERVICE_HOST):$(KUBERNETES_SERVICE_PORT)
- -namespace={{ .Release.Namespace }}
- -daemonset=hook-image-puller-{{ .Release.Time.Seconds }}
- -daemonset=hook-image-puller
{{- end }}
14 changes: 7 additions & 7 deletions jupyterhub/templates/image-puller/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ This service account...
apiVersion: v1
kind: ServiceAccount
metadata:
name: hook-image-awaiter-{{ .Release.Time.Seconds }}
name: hook-image-awaiter
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "0"
---
{{- /*
Expand All @@ -24,7 +24,7 @@ metadata:
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: hook-image-awaiter-{{ .Release.Time.Seconds }}
name: hook-image-awaiter
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
Expand All @@ -43,21 +43,21 @@ rules:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: hook-image-awaiter-{{ .Release.Time.Seconds }}
name: hook-image-awaiter
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "0"
subjects:
- kind: ServiceAccount
name: hook-image-awaiter-{{ .Release.Time.Seconds }}
name: hook-image-awaiter
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: hook-image-awaiter-{{ .Release.Time.Seconds }}
name: hook-image-awaiter
apiGroup: rbac.authorization.k8s.io
{{- end }}
{{- end }}

0 comments on commit 9731556

Please sign in to comment.