apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mailu-smtp
  namespace: mailu-mailserver
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: mailu-smtp
        role: mail
        tier: backend
    spec:
      containers:
      - name: smtp
        image: mailu/postfix:master
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: mailu-config
        resources:
          requests:
            memory: 2Gi
            cpu: 500m
          limits:
            memory: 2Gi
            cpu: 500m
        volumeMounts:
          - mountPath: /data
            name: maildata
            subPath: maildata
          - mountPath: /overrides
            name: maildata
            subPath: overrides
        ports:
          - name: smtp
            containerPort: 25
            protocol: TCP
          - name: smtp-ssl
            containerPort: 465
            protocol: TCP
          - name: smtp-starttls
            containerPort: 587
            protocol: TCP
          - name: smtp-auth
            containerPort: 10025
            protocol: TCP
      volumes:
        - name: maildata
          persistentVolumeClaim:
            claimName: mail-storage
---
apiVersion: v1
kind: Service
metadata:
  name: smtp
  namespace: mailu-mailserver
  labels:
    app: mailu
    role: mail
    tier: backend
spec:
  selector:
    app: mailu-smtp
    role: mail
    tier: backend
  ports:
  - name: smtp
    port: 25
    protocol: TCP
  - name: smtp-ssl
    port: 465
    protocol: TCP
  - name: smtp-starttls
    port: 587
    protocol: TCP
  - name: smtp-auth
    port: 10025
    protocol: TCP
