apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: mail-suit-service
  name: mailman-database
  namespace: mail
spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: mail-suit-service
  serviceName: mail-suit-service
  template:
    metadata:
      labels:
        app: mail-suit-service
    spec:
      containers:
      - env:
        - name: POSTGRES_DB
          value: mailmandb
        - name: POSTGRES_USER
          valueFrom:
            secretKeyRef:
              name: mailman-secrets
              key: postgres_user
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mailman-secrets
              key: postgres_password
        - name: PGDATA
          value: /var/lib/postgresql/data/postgres
        image: swr.cn-north-4.myhuaweicloud.com/opensourceway/common/postgres:9.6-alpine
        imagePullPolicy: IfNotPresent
        name: mailman-database
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: mailman-database-volume
          subPath: postgres
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: mailman-database-volume
        persistentVolumeClaim:
          claimName: db-data-vol
  updateStrategy:
    type: OnDelete
