apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mailu-imap
  namespace: mailu-mailserver
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: mailu-imap
        role: mail
        tier: backend
    spec:
      containers:
      - name: imap
        image: mailu/dovecot:master
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: mailu-config
        volumeMounts:
          - mountPath: /data
            name: maildata
            subPath: maildata
          - mountPath: /mail
            name: maildata
            subPath: mailstate
          - mountPath: /overrides
            name: maildata
            subPath: overrides
        ports:
          - containerPort: 2102
          - containerPort: 2525
          - containerPort: 143
          - containerPort: 993
          - containerPort: 4190
        resources:
          requests:
            memory: 1Gi
            cpu: 1000m
          limits:
            memory: 1Gi
            cpu: 1000m
      volumes:
        - name: maildata
          persistentVolumeClaim:
            claimName: mail-storage
---
apiVersion: v1
kind: Service
metadata:
  name: imap
  namespace: mailu-mailserver
  labels:
    app: mailu
    role: mail
    tier: backend
spec:
  selector:
    app: mailu-imap
    role: mail
    tier: backend
  ports:
  ports:
  - name: imap-auth
    port: 2102
    protocol: TCP
  - name: imap-transport
    port: 2525
    protocol: TCP
  - name: imap-default
    port: 143
    protocol: TCP
  - name: imap-ssl
    port: 993
    protocol: TCP
  - name: sieve
    port: 4190
    protocol: TCP