apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: logspout-papertrail
spec:
  selector:
    matchLabels:
      name: logspout-papertrail
  template:
    metadata:
      labels:
        name: logspout-papertrail
    spec:
      containers:
        - resources:
            requests:
              cpu: 0.15
            limits:
              memory: 500Mi
          env:
            - name: SYSLOG_TAG
              value: '{{ index .Container.Config.Labels "io.kubernetes.pod.namespace" }}[{{ index .Container.Config.Labels "io.kubernetes.pod.name" }}]'
            - name: SYSLOG_HOSTNAME
              value: '{{ index .Container.Config.Labels "io.kubernetes.container.name" }}'
            - name: ROUTE_URIS
              valueFrom:
                secretKeyRef:
                  name: papertrail-destination
                  key: papertrail-destination
          image: gliderlabs/logspout:master
          name: logspout
          volumeMounts:
            - name: log
              mountPath: /var/run/docker.sock
      volumes:
        - name: log
          hostPath:
              path: /var/run/docker.sock
