apiVersion: apps/v1
kind: Deployment
metadata:
  name: retraced-processor
  namespace: '{{repl ConfigOption "namespace"}}'
spec:
  selector:
    matchLabels:
      tier: processor
  replicas: 2
  template:
    metadata:
      labels:
        app: auditlog 
        tier: processor
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 2
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - auditlog
                - key: tier
                  operator: In
                  values:
                  - processor
              topologyKey: "kubernetes.io/hostname"
      volumes:
        - name: tmpdir
          emptyDir: {}
      containers:
        - name: processor
          image: registry.replicated.com/library/retraced:1.4.6
          imagePullPolicy: IfNotPresent

          command:
            - /src/processor
          ports:
            - containerPort: 3000
              name: http
              protocol: TCP
          readinessProbe:
            httpGet:
              port: 3000
              path: /healthz
            initialDelaySeconds: 3
            periodSeconds: 1
            failureThreshold: 2
            successThreshold: 2
          livenessProbe:
            httpGet:
              port: 3000
              path: /livez
            initialDelaySeconds: 3
            periodSeconds: 1
          resources:
            requests:
              cpu: 100m
            limits:
              cpu: 1000m

          volumeMounts:
            - mountPath: /tmp
              name: tmpdir
          envFrom:
          - secretRef:
              name: auditlog
          env:

            - name: TMPDIR
              value: /tmp
            - name: NO_WARP_PIPE
              value: "1"
            - name: BUGSNAG_TOKEN
              valueFrom:
                secretKeyRef:
                  name: auditlog
                  key: PROCESSOR_TOKEN
            - name: PG_SEARCH
              value: ""
      imagePullSecrets:
      - name: auditlog-imagepull-secret

