apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: curator
  labels:
    app: curator
    stack: efk
spec:
  schedule: "0 0 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          affinity:
            nodeAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                nodeSelectorTerms:
                - matchExpressions:
                  - key: efk-node
                    operator: In
                    values:
                    - "true"
          containers:
          - name: curator
            image: bobrik/curator:latest
            command: ["/usr/bin/curator", "--config", "/etc/curator/config.yml", "/etc/curator/action.yml"]
            env:
            - name: ELASTIC_SEARCH_HOST
              value: "elasticsearch.$NAMESPACE.svc"
            - name: ELASTIC_SEARCH_PORT
              value: "9200"
            - name: FILTER_REGEX
              value: "^(nginx.access-|web.error-|php.error-).*$"
            - name: EXPIRATION_DAYS
              value: "30"
            volumeMounts:
            - name: config
              mountPath: /etc/curator
          restartPolicy: OnFailure
          volumes:
          - name: config
            configMap:
              name: curator
