apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: synapse-postgres-statefulset
  labels:
    app: postgres
spec:
  serviceName: "synapse-postgres"
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
      - name: postgres
        image: postgres:12
        envFrom:
        - configMapRef:
            name: synapse-postgres-configmap
        ports:
        - containerPort: 5432
          name: postgresdb
        volumeMounts:
        - name: data
          mountPath: /var/lib/postgresql/
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: synapse-postgres-pvc
