apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
spec:
  selector:
    matchLabels:
      app: postgres
      env: prod
      storageos.com/hint.master: <NODE_NAME>
  serviceName: postgres
  replicas: 1
  template:
    metadata:
      labels:
        app: postgres
        env: prod
        storageos.com/hint.master: <NODE_NAME>
    spec:
      serviceAccountName: postgres
      securityContext:
        runAsUser: 26
        fsGroup: 26
      containers:
      - name: pg
        image: crunchydata/crunchy-postgres:centos7-10.8-2.4.0
        volumeMounts:
          - name: pg-data
            mountPath: /pgdata
        envFrom:
        - configMapRef:
            name: postgres
      nodeSelector:
        app: postgres
  volumeClaimTemplates:
  - metadata:
      name: pg-data
      labels:
        env: prod
    spec:
      accessModes: ["ReadWriteOnce"]
      storageClassName: "fast" # StorageOS storageClass 
      resources:
        requests:
          storage: 15Gi
