apiVersion: apps/v1
kind: Deployment
metadata:
  name: mailu-fetchmail
  namespace: mailu-mailserver
spec:
  selector:
    matchLabels:
      app: mailu-fetchmail
  replicas: 1
  template:
    metadata:
      labels:
        app: mailu-fetchmail
        role: mail
        tier: backend
    spec:
      containers:
      - name: fetchmail
        image: mailu/fetchmail:master
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: mailu-config
        volumeMounts:
          - name: maildata
            mountPath: /data
            subPath: maildata
        ports:
          - containerPort: 5232
          - containerPort: 80
      volumes:
        - name: maildata
          persistentVolumeClaim:
            claimName: mail-storage
