
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mailu-security
  namespace: mailu-mailserver
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: mailu-security
        role: mail
        tier: backend
    spec:
      containers:
      - name: antispam
        image: mailu/rspamd:master
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: mailu-config
        resources:
          requests:
            memory: 100Mi
            cpu: 100m
          limits:
            memory: 200Mi
            cpu: 200m
        ports:
          - name: antispam
            containerPort: 11332
            protocol: TCP
          - name: antispam-http
            containerPort: 11334
            protocol: TCP
        volumeMounts:
          - name: filter
            subPath: filter
            mountPath: /var/lib/rspamd
          - name: filter
            mountPath: /dkim
            subPath: dkim
          - name: filter
            mountPath: /etc/rspamd/override.d
            subPath: rspamd-overrides
      - name: antivirus
        image: mailu/clamav:master
        imagePullPolicy: Always
        resources:
          requests:
            memory: 1Gi
            cpu: 1000m
          limits:
            memory: 2Gi
            cpu: 1000m
        envFrom:
          - configMapRef:
              name: mailu-config
        ports:
          - name: antivirus
            containerPort: 3310
            protocol: TCP
        volumeMounts:
          - name: filter
            subPath: filter
            mountPath: /data
      volumes:
        - name: filter
          persistentVolumeClaim:
            claimName: mail-storage

---

apiVersion: v1
kind: Service
metadata:
  name: antispam
  namespace: mailu-mailserver
  labels:
    app: mailu-antispam
    role: mail
    tier: backend
spec:
  selector:
    app: mailu-security
    role: mail
    tier: backend
  ports:
  - name: antispam
    port: 11332
    protocol: TCP
  - name: antispam-http
    protocol: TCP
    port: 11334

---

apiVersion: v1
kind: Service
metadata:
  name: antivirus
  namespace: mailu-mailserver
  labels:
    app: mailu-antivirus
    role: mail
    tier: backend
spec:
  selector:
    app: mailu-security
    role: mail
    tier: backend
  ports:
  - name: antivirus
    port: 3310
    protocol: TCP