{{ if .Values.downloads.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: downloads
spec:
  replicas: 1
  selector:
    matchLabels:
      app: downloads
  template:
    metadata:
      name: downloads
      labels:
        app: downloads
    spec:
      containers:
      - name: downloads
        image: docker.io/goalprofit/downloads:{{.Values.downloads.version}}
        imagePullPolicy: Always
        ports:
          - containerPort: 8080
{{ if .Values.downloads.enabled }}
        volumeMounts:
        - mountPath: /downloads
          name: downloads
          subPath: data/downloads
      volumes:
      - name: downloads
        {{ include "app.customer_volume" . | nindent 8}}

      {{ include "app.affinity" . | nindent 6}}
{{ end }}

      imagePullSecrets:
      - name: regcred
---
apiVersion: v1
kind: Service
metadata:
  name: downloads
spec:
  type: ClusterIP
  selector:
    app: downloads
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080
{{ end }}
