apiVersion: apps/v1
kind: Deployment
metadata:
  name: mailman
  labels:
    app: mailman
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mailman
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: mailman
    spec:
      containers:
        - name: mailman
          image: mailman:dev
          imagePullPolicy: IfNotPresent
          args:
            - -config-file=/etc/mailman/config/config.json,/etc/mailman/secret-config/config.json
            - -log-level=DEBUG
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          volumeMounts:
            - name: config-volume
              mountPath: /etc/mailman/config
            - name: secret-config-volume
              mountPath: /etc/mailman/secret-config
          livenessProbe:
            httpGet:
              port: http
              path: /health
            initialDelaySeconds: 5
            periodSeconds: 5
          readinessProbe:
            httpGet:
              port: http
              path: /health
            initialDelaySeconds: 5
            periodSeconds: 5
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      volumes:
        - name: config-volume
          configMap:
            name: mailman-config
        - name: secret-config-volume
          secret:
            secretName: mailman-secret
