---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: filebeat-netflow-ds
  labels:
    component: filebeat-netflow
spec:
  selector:
    matchLabels:
      component: filebeat-netflow
  template:
    metadata:
      labels:
        component: filebeat-netflow
    spec:
      volumes:
        - name: filebeat-netflow-cert
          secret:
            secretName: filebeat-netflow-cert
        - name: filebeat-netflow-config
          configMap:
            name: filebeat-netflow-config
      containers:
        - name: filebeat-netflow
          image: docker.elastic.co/beats/filebeat:7.14.2-amd64
          volumeMounts:
            - name: filebeat-netflow-config
              mountPath: /usr/share/filebeat/filebeat.yml
              subPath: filebeat.yml
            - name: filebeat-netflow-cert
              mountPath: /usr/share/filebeat/certs/
          env:
            - name: ELASTIC_HOST
              value: "elastic-svc"
            - name: ELASTIC_PORT
              value: "9200"
            - name: ELASTIC_USERNAME
              valueFrom:
                secretKeyRef:
                  name: filebeat-netflow-elastic-cred
                  key: username
            - name: ELASTIC_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: filebeat-netflow-elastic-cred
                  key: password
          ports:
            - name: "udp-2055"
              protocol: UDP
              containerPort: 2055
              hostPort: 2055
