apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: telegraf
  namespace: ft-services
  labels:
    app: telegraf
spec:
  selector:
    matchLabels:
      name: telegraf
  template:
    metadata:
      labels:
        name: telegraf
    spec:
      containers:
      - name: telegraf
        image: telegraf:local
        env:
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: HOSTIP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
        envFrom:
         - configMapRef:
             name: influxdb-configmap
         - secretRef:
             name: influxdb-pass
        volumeMounts:
        - name: docker-socket
          mountPath: /var/run/docker.sock
        - name: config
          mountPath: /etc/telegraf/telegraf.conf
          subPath: telegraf.conf
          readOnly: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: docker-socket
        hostPath:
          path: /var/run/docker.sock
      - name: config
        configMap:
          name: telegraf
