daemonset.yaml 2.56 KB
Newer Older
1 2 3 4 5
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: {{ include "telegraf.fullname" . }}
  labels:
6
    {{- include "telegraf.labels" . | nindent 4 }}
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ include "telegraf.name" . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ include "telegraf.name" . }}
        app.kubernetes.io/instance: {{ .Release.Name }}
      annotations:
        # Include a hash of the configmap in the pod template
        # This means that if the configmap changes, the deployment will be rolled
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
    spec:
      serviceAccountName: {{ template "telegraf.serviceAccountName" . }}
23 24 25
{{- if .Values.priorityClassName }}
      priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
26 27 28 29 30 31
      containers:
      - name: {{ .Chart.Name }}
        image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}"
        imagePullPolicy: {{ default "" .Values.image.pullPolicy | quote }}
        resources:
{{ toYaml .Values.resources | indent 10 }}
32 33 34 35
        {{- if .Values.args }}
        args:
{{ toYaml .Values.args | indent 8 }}
        {{- end }}
36
        env:
37 38 39 40
        - name: HOSTIP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
41 42 43 44 45
{{ toYaml .Values.env | indent 8 }}
        volumeMounts:
        - name: varrunutmpro
          mountPath: /var/run/utmp
          readOnly: true
46 47
        - name: hostfsro
          mountPath: /hostfs
48 49 50 51 52
          readOnly: true
        - name: docker-socket
          mountPath: /var/run/docker.sock
        - name: config
          mountPath: /etc/telegraf
53 54 55 56 57 58 59 60 61
      {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
62 63
      tolerations:
{{ toYaml . | indent 8 }}
64
      {{- end }}
65
      volumes:
66
      - name: hostfsro
67
        hostPath:
68
          path: /
69 70 71 72 73 74 75 76 77
      - name: docker-socket
        hostPath:
          path: /var/run/docker.sock
      - name: varrunutmpro
        hostPath:
          path: /var/run/utmp
      - name: config
        configMap:
          name:  {{ include "telegraf.fullname" . }}
78 79 80 81
      hostNetwork: {{ default .Values.hostNetwork  false }}
      {{- if .Values.dnsPolicy }}
      dnsPolicy: {{ .Values.dnsPolicy }}
      {{- end }}
82 83 84 85
      {{- with .Values.dnsConfig }}
      dnsConfig:
{{ toYaml . | indent 8 }}
      {{- end }}