---
# Source: logstash/templates/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: central-logstash
  labels:
    app: "central-logstash"
    chart: "logstash"
    heritage: "Helm"
    release: "central"
spec:
  serviceName: central-logstash-headless
  selector:
    matchLabels:
      app: "central-logstash"
      release: "central"
  replicas: 1
  podManagementPolicy: Parallel
  updateStrategy:
    type: RollingUpdate
  volumeClaimTemplates:
  - metadata:
      name: central-logstash
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
  template:
    metadata:
      name: "central-logstash"
      labels:
        app: "central-logstash"
        chart: "logstash"
        heritage: "Helm"
        release: "central"
      annotations:
        configchecksum: 955238aff6bfd3a0f817fa834e34cc8bb81136d09c1d32b38d22ade6a98891e
        pipelinechecksum: 42731beed61febbae57f39fc841d32817ef45879278b300a2192ef2be447116
    spec:
      securityContext:
        fsGroup: 1000
        runAsUser: 1000
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              topologyKey: kubernetes.io/hostname
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - "central-logstash"
      terminationGracePeriodSeconds: 120
      volumes:
        - name: logstashconfig
          configMap:
            name: central-logstash-config
        - name: logstashpipeline
          configMap:
            name: central-logstash-pipeline
      containers:
      - name: "logstash"
        securityContext:
          capabilities:
            drop:
            - ALL
          runAsNonRoot: true
          runAsUser: 1000
        image: "docker.elastic.co/logstash/logstash-oss:7.10.1"
        imagePullPolicy: "IfNotPresent"
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /
            port: http
          initialDelaySeconds: 300
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /
            port: http
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 3
          timeoutSeconds: 5
        ports:
        - name: http
          containerPort: 9600
        resources:
          limits:
            cpu: 1000m
            memory: 1536Mi
          requests:
            cpu: 100m
            memory: 1536Mi
        env:
          - name: LS_JAVA_OPTS
            value: "-Xmx1g -Xms1g"
        volumeMounts:
          - name: "central-logstash"
            mountPath: /usr/share/logstash/data
          - name: logstashconfig
            mountPath: /usr/share/logstash/config/logstash.yml
            subPath: logstash.yml
          - name: logstashpipeline
            mountPath: /usr/share/logstash/pipeline/uptime.conf
            subPath: uptime.conf
