{{ if .Values.auth.enabled }}

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth
  template:
    metadata:
      name: auth
      labels:
        app: auth
    spec:
      containers:
      - name: auth
        image: docker.io/goalprofit/auth
        imagePullPolicy: Always
        command:
          - python3
          - "-u"
          - auth.py
        workingDir: /data/{{.Values.customer}}/data
        volumeMounts:
        - mountPath: /data
          name: data
        env:
        - name: TZ
          value: {{ .Values.timeZone }}
        ports:
          - containerPort: 5088

      imagePullSecrets:
      - name: regcred

      volumes:
      - name: data
        hostPath:
          path: /data
          type: Directory
      {{ include "app.affinity" . | nindent 6}}
---
apiVersion: v1
kind: Service
metadata:
  name: auth
spec:
  type: ClusterIP
  selector:
    app: auth
  ports:
    - name: http
      protocol: TCP
      port: 5088
      targetPort: 5088
#      nodePort: {{.Values.auth.port}}

{{ end }}