---
apiVersion: apps/v1
kind: Deployment
metadata: 
  name: mail
  namespace: wordpress-stack
  labels:
    app.kubernetes.io/name: mail
    app.kubernetes.io/tier: frontend
    app.kubernetes.io/version: "0.1"
    app.kubernetes.io/environment: dev
    app.kubernetes.io/namespace: wordpress-stack
    app.kubernetes.io/part-of: wordpress-project
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: mail
      app.kubernetes.io/tier: frontend
      app.kubernetes.io/version: "0.1"
      app.kubernetes.io/environment: dev
      app.kubernetes.io/namespace: wordpress-stack
      app.kubernetes.io/part-of: wordpress-project
  template:
    metadata:
      labels:
        app.kubernetes.io/name: mail
        app.kubernetes.io/tier: frontend
        app.kubernetes.io/version: "0.1"
        app.kubernetes.io/environment: dev
        app.kubernetes.io/namespace: wordpress-stack
        app.kubernetes.io/part-of: wordpress-project
    spec:
      containers:
        - name: mail 
          image: analogic/poste.io:2
          envFrom:
            - configMapRef:
                name: mail-config
          ports:
            - containerPort: 80
            - containerPort: 443
            - containerPort: 25
            - containerPort: 110
            - containerPort: 143
            - containerPort: 465
            - containerPort: 587
            - containerPort: 993
            - containerPort: 995
            - containerPort: 4190
          volumeMounts:
            - name: mail-data
              mountPath: /data
              readOnly: false
            - name: server-ini
              mountPath: /data/server.ini
              subPath: server.ini
              readOnly: false
            - name: usersdb
              mountPath: /data/users.db
              subPath: users.db
              readOnly: false
            - name: davdb
              mountPath: /data/dav.db
              subPath: dav.db
              readOnly: false
      volumes:
        - name: mail-data
          persistentVolumeClaim: 
            claimName: mail-storage
        - name: server-ini
          configMap:
            name: mail-server-ini-file
        - name: usersdb
          configMap:
            name: mail-userdb-file
        - name: davdb
          configMap: 
            name: mail-davdb-file
        
