daemonset.yaml 3.32 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
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 }}
17 18 19
        {{- with .Values.podLabels }}
{{ toYaml . | indent 8 }}
        {{- end }}
20
      annotations:
21 22
        # Include a hash of the configmap in the pod template
        # This means that if the configmap changes, the deployment will be rolled
23
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
24 25 26
        {{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
        {{- end }}
27 28
    spec:
      serviceAccountName: {{ template "telegraf.serviceAccountName" . }}
29 30 31
{{- if .Values.priorityClassName }}
      priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
32 33 34 35 36 37
      containers:
      - name: {{ .Chart.Name }}
        image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}"
        imagePullPolicy: {{ default "" .Values.image.pullPolicy | quote }}
        resources:
{{ toYaml .Values.resources | indent 10 }}
38 39 40 41
        {{- if .Values.args }}
        args:
{{ toYaml .Values.args | indent 8 }}
        {{- end }}
42 43
        env:
{{ toYaml .Values.env | indent 8 }}
44 45 46 47 48
        {{- if .Values.envFromSecret }}
        envFrom:
          - secretRef:
              name: {{ .Values.envFromSecret }}
{{- end }}
49 50 51 52
        volumeMounts:
        - name: varrunutmpro
          mountPath: /var/run/utmp
          readOnly: true
53 54
        - name: hostfsro
          mountPath: /hostfs
55
          readOnly: true
56
        {{- if hasPrefix "unix" .Values.config.docker_endpoint }}
57
        - name: docker-socket
58 59
          mountPath: {{ trimPrefix "unix://" .Values.config.docker_endpoint }}
        {{- end }}
60 61
        - name: config
          mountPath: /etc/telegraf
62 63 64
        {{- if .Values.mountPoints }}
{{ toYaml .Values.mountPoints | indent 8 }}
        {{- end }}
65 66 67 68 69 70 71 72 73
      {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
74 75
      tolerations:
{{ toYaml . | indent 8 }}
76
      {{- end }}
77
      volumes:
78
      - name: hostfsro
79
        hostPath:
80
          path: /
81
      {{- if hasPrefix "unix" .Values.config.docker_endpoint }}
82 83
      - name: docker-socket
        hostPath:
84 85 86
          path: {{ trimPrefix "unix://" .Values.config.docker_endpoint }}
          type: Socket
      {{- end }}
87 88 89 90 91 92
      - name: varrunutmpro
        hostPath:
          path: /var/run/utmp
      - name: config
        configMap:
          name:  {{ include "telegraf.fullname" . }}
93 94 95
      {{- if .Values.volumes }}
{{ toYaml .Values.volumes | indent 6 }}
      {{- end }}
96
      hostNetwork: {{ default false .Values.hostNetwork }}
97 98 99
      {{- if .Values.dnsPolicy }}
      dnsPolicy: {{ .Values.dnsPolicy }}
      {{- end }}
100 101 102 103
      {{- with .Values.dnsConfig }}
      dnsConfig:
{{ toYaml . | indent 8 }}
      {{- end }}
104 105 106
      {{- with .Values.podSecurityContext }}
      securityContext:
{{ toYaml . | indent 8 }}
107
      {{- end }}