
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mailu-front
  namespace: mailu-mailserver
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: mailu-front
        role: mail
        tier: backend
    spec:
      restartPolicy: Always
      terminationGracePeriodSeconds: 60
      containers:
      - name: front
        image: mailu/nginx:latest
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: mailu-config
        volumeMounts:
          - name: certs
            mountPath: /certs
        ports:
          - name: http
            containerPort: 80
            protocol: TCP
          - name: https
            containerPort: 443
            protocol: TCP
          - name: pop3
            containerPort: 110
            protocol: TCP
          - name: pop3s
            containerPort: 995
            protocol: TCP
          - name: imap
            containerPort: 143
            protocol: TCP
          - name: imaps
            containerPort: 993
            protocol: TCP
          - name: smtp
            containerPort: 25
            protocol: TCP
          - name: smtp-auth
            containerPort: 10025
            protocol: TCP
          - name: imap-auth
            containerPort: 10143
            protocol: TCP
          - name: smtps
            containerPort: 465
            protocol: TCP
          - name: smtpd
            containerPort: 587
            protocol: TCP
          - name: auth
            containerPort: 8000
            protocol: TCP
        resources:
          requests:
            memory: 100Mi
            cpu: 100m
          limits:
            memory: 200Mi
            cpu: 200m
      volumes:
        - name: certs
          secret:
            items:
              - key: tls.crt
                path: cert.pem
              - key: tls.key
                path: key.pem
            secretName: letsencrypt-certs-all
---
apiVersion: v1
kind: Service
metadata:
  name: front
  namespace: mailu-mailserver
  labels:
    app: mailu-admin
    role: mail
    tier: backend
spec:
  selector:
    app: mailu-front
    role: mail
    tier: backend
  ports:
  - name: http
    port: 80
    protocol: TCP
  - name: https
    port: 443
    protocol: TCP
  - name: pop3
    port: 110
    protocol: TCP
  - name: pop3s
    port: 995
    protocol: TCP
  - name: imap
    port: 143
    protocol: TCP
  - name: imaps
    port: 993
    protocol: TCP
  - name: smtp
    port: 25
    protocol: TCP
  - name: smtps
    port: 465
    protocol: TCP
  - name: smtpd
    port: 587
    protocol: TCP
  - name: smtp-auth
    port: 10025
    protocol: TCP
  - name: imap-auth
    port: 10143
    protocol: TCP
