{{ if .Values.debug.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: debug
spec:
  replicas: 1
  selector:
    matchLabels:
      app: debug
  template:
    metadata:
      name: debug
      labels:
        app: debug
    spec:
      terminationGracePeriodSeconds: 1
      containers:
      - name: debug
        image: docker.io/goalprofit/debug-pod:{{.Values.debug.version}}
        imagePullPolicy: Always
        volumeMounts:
        - mountPath: /customer
          name: customer
        env:
{{ if .Values.local_user_id }}
        - name: LOCAL_USER_ID
          value: "{{.Values.local_user_id}}"
{{ end }}
{{ if .Values.local_user_name }}
        - name: LOCAL_USER_NAME
          value: "{{.Values.local_user_name}}"
{{ end }}

      imagePullSecrets:
      - name: regcred

      volumes:
      - name: customer
        {{ include "app.customer_volume" . | nindent 8}}
      {{ include "app.affinity" . | nindent 6}}
{{ end }}