apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres-statefulset
spec:
  replicas: 1
  serviceName: postgres-service
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        - name: postgres
          image: postgres:12-alpine
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 5432
          env:
            - name: POSTGRES_DB
              value: WMS
            # - name: POSTGRES_USER
            #   value: postgres
            - name: POSTGRES_PASSWORD
              value: "1234"
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: pg-data
          resources: {}
  volumeClaimTemplates:
    - metadata:
        name: pg-data
      spec:
        storageClassName: standard
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: 1Gi
