Skip to content

Instantly share code, notes, and snippets.

@mrballcb
Created August 20, 2018 11:21
Show Gist options
  • Save mrballcb/8a837ef1e6effa61fc848abd1b175351 to your computer and use it in GitHub Desktop.
Save mrballcb/8a837ef1e6effa61fc848abd1b175351 to your computer and use it in GitHub Desktop.
Helm daemonset yaml template for pre-pulling images.
apiVersion: apps/v1beta2
kind: DaemonSet
metadata:
name: {{ .Release.Name }}-prepull
labels:
app: {{ template "name" . }}
env: {{ .Values.environment }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
name: {{ .Release.Name }}-prepull
template:
metadata:
labels:
name: {{ .Release.Name }}-prepull
release: {{ .Release.Name }}
env: {{ .Values.environment }}
spec:
imagePullSecrets:
- name: {{ .Values.image.imagePullSecret }}
initContainers:
- name: prepull
image: {{ .Values.image.repository}}:{{ .Values.image.tag }}
command: ["sh", "-c", "echo 'Pre-Pull of {{ .Values.image.repository}}:{{ .Values.image.tag }} successful'"]
volumeMounts:
- name: docker
mountPath: /var/run
volumes:
- name: docker
hostPath:
path: /var/run
containers:
- name: pause
image: gcr.io/google_containers/pause
{{- if .Values.toleration }}
nodeSelector:
kops.k8s.io/instancegroup: {{ .Values.toleration.name }}
tolerations:
- key: "{{ .Values.toleration.name }}"
operator: "Exists"
effect: "{{ .Values.toleration.type }}"
{{- end }}
@Lastcysa
Copy link

Lastcysa commented Jun 4, 2019

Hi mrballcb,
I have a silly question: How to use this yaml file? Tried helm install my-chart -f daemonset.yaml but there's always the error Error: failed to parse daemonsets.yaml: error converting YAML to JSON: yaml: line 3: did not find expected key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment