apiVersion: apps/v1
kind: Deployment
metadata:
  name: logstash
spec:
  # replicas: 1
  selector:
    matchLabels:
      app: logstash
  template:
    metadata:
      labels:
        app: logstash
    spec:
      containers:
        - name: logstash
          image: logstash:7.9.3
          command: ["bin/logstash", "-f", "/usr/share/logstash/logstash.conf"]
          ports:
            - containerPort: 5044
          volumeMounts:
            - name: logstash-conf
              mountPath: /usr/share/logstash/logstash.conf
              subPath: logstash.conf
            - name: job-status-mapping
              mountPath: /usr/share/logstash/job_status.template.json
              subPath: job_status.template.json
            - name: task-status-mapping
              mountPath: /usr/share/logstash/task_status.template.json
              subPath: taks_status.template.json
            - name: event-status-mapping
              mountPath: /usr/share/logstash/event_status.template.json
              subPath: event_status.template.json
            - name: worker-status-mapping
              mountPath: /usr/share/logstash/worker_status.template.json
              subPath: worker_status.template.json
            - name: logstash-yml
              mountPath: /usr/share/logstash/config/logstash.yml
              subPath: logstash.yml
      volumes:
        - name: logstash-conf
          configMap:
            name: logstash-configs
            items:
              - key: logstash-conf
                path: logstash.conf
        - name: job-status-mapping
          configMap:
            name: logstash-configs
            items:
              - key: job-status
                path: job_status.template.json
        - name: task-status-mapping
          configMap:
            name: logstash-configs
            items:
              - key: task-status
                path: taks_status.template.json
        - name: event-status-mapping
          configMap:
            name: logstash-configs
            items:
              - key: event-status
                path: event_status.template.json
        - name: worker-status-mapping
          configMap:
            name: logstash-configs
            items:
              - key: worker-status
                path: worker_status.template.json
        - name: logstash-yml
          configMap:
            name: logstash-configs
            items:
              - key: logstash-yml
                path: logstash.yml
