apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-config
  namespace: infra
data:
  filebeat.yml: |
    filebeat:
      prospectors:
        - input_type: log
          document_type: kraken-metrics
          paths:
              - /home/zoox/kraken-log/tentacle.log
          # We only output Kraken metrics as INFO, and all other
          # exceptions/error logs remain in the Kraken log file,
          # if we want to investigate
          include_lines: ['^INFO: {']

    output:
      logstash:
        hosts: ["kraken-logstash.zooxlabs.com:5044"]
        bulk_max_size: 1024
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kraken-worker
  namespace: infra
spec:
  selector:
    matchLabels:
      app: kraken-worker
  template:
    metadata:
      labels:
        app: kraken-worker
    spec:
      hostNetwork: true
      containers:
      - name: kraken-worker
        image: docker-registry.zooxlabs.com/tentacle:3.0.0
        ports:
        - containerPort: 8080
          hostPort: 8080
          name: http
        resources:
          limits:
            memory: 100Gi
            cpu: "35"
          requests:
            memory: 100Gi
            cpu: "35"
        volumeMounts:
        - name: cache
          mountPath: /dev/shm/worker
        - name: log
          mountPath: /home/zoox/kraken-log
      - name: filebeat
        image: docker.elastic.co/beats/filebeat:5.2.1
        command:
        - filebeat
        - -e
        - -path.config=/config
        volumeMounts:
        - name: log
          mountPath: /home/zoox/kraken-log
        - name: filebeat-config
          mountPath: /config
      nodeSelector:
        kraken: "true"
      volumes:
      - name: cache
        emptyDir:
          medium: Memory
          sizeLimit: 50Gi
      - name: log
        emptyDir: {}
      - name: filebeat-config
        configMap:
          name: filebeat-config
