{{ if .Values.comp.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: comp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: comp
  template:
    metadata:
      name: comp
      labels:
        app: comp
    spec:
      containers:
      - name: comp
        image: docker.io/goalprofit/env:1.1
        imagePullPolicy: Always
        args:
          - bash
          - -c
          - |
            while true
            do
            python3 comp.py
            sleep 15m
            done        
        workingDir: /work
        volumeMounts:
        - mountPath: /work
          name: work
        env:
        - name: TZ
          value: {{ .Values.timeZone }}
        - name: SERVICE_LOGIN
          valueFrom:
            secretKeyRef:
              name: secret-service
              key: username
              optional: false
        - name: SERVICE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: secret-service
              key: password
              optional: false
{{ 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: work
        hostPath:
          path: /data/{{.Values.customer}}/in/int/retail
          type: Directory
          type: Directory
      {{ include "app.affinity" . | nindent 6}}
{{ end }}