{{ if .Values.pim20_data_loader.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: pim20-data-loader
spec:
  type: ClusterIP
  selector:
    app: pim20-data-loader
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pim20-data-loader
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pim20-data-loader
  template:
    metadata:
      name: pim20-data-loader
      labels:
        app: pim20-data-loader
    spec:
      containers:
        - name: pim20-data-loader
          image: goalprofit/pim20-data-loader:{{.Values.pim20_data_loader.version}}
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
          env:
            - name: API_SERVICE
              value: http://server-api:8080
            - name: PORT
              value: "8080"
            - name: DATA_PATH
              value: /tmp
            - name: BASE_URL
              value: /data_loader
            - name: SERVICE_LOGIN
              valueFrom:
                secretKeyRef:
                  name: secret-service
                  key: username
            - name: SERVICE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: secret-service
                  key: password
      imagePullSecrets:
      - name: regcred
{{ end }}