{{ if .Values.pypi_server.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pypi-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pypi-server
  template:
    metadata:
      name: pypi-server
      labels:
        app: pypi-server
    spec:
      containers:
      - name: pypi-server
        image: docker.io/goalprofit/pypi-server:{{.Values.pypi_server.version}}
        imagePullPolicy: Always
        ports:
          - containerPort: 8080

        volumeMounts:
        - mountPath: /pypi-server
          name: pypi-server


      volumes:
      - name: pypi-server
        hostPath:
          path: /data/{{.Values.customer}}/data/pypi-server
          type: Directory
      imagePullSecrets:
      - name: regcred
      volumes:
      - name: customer
       {{ include "app.customer_volume" . | nindent 8}}

      {{ include "app.affinity" . | nindent 6}}
---
apiVersion: v1
kind: Service
metadata:
  name: pypi-server
spec:
  type: ClusterIP
  selector:
    app: pypi-server
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080
{{ end }}