---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgresql
  labels:
    app.kubernetes.io/name: postgresql
spec:
  selector:
    matchLabels:
      app: postgresql
  template:
    metadata:
      labels:
        app: postgresql
    spec:
      containers:
        - name: postgresql
          image: quay.io/redhatdemo/openshift-pgsql12-primary:centos7
          imagePullPolicy: Always
          resources:
            limits:
              memory: "1Gi"
              cpu: "1"
          ports:
            - name: tcp
              containerPort: 5432
          env:
            - name: PG_USER_PASSWORD
              value: tradedb
            - name: PG_USER_NAME
              value: tradedb
            - name: PG_DATABASE
              value: tradedb
            - name: PG_NETWORK_MASK
              value: all
            - name: PG_MAX_CONNECTIONS
              value: "100"
            - name: PG_SHARED_BUFFERS
              value: "250"
            - name: PG_WORK_MEM
              value: "128"
            - name: PG_EFFECTIVE_CACHE_SIZE
              value: "750"
            - name: PG_EFFECTIVE_IO
              value: "128"
            - name: PG_MAX_WAL_SIZE
              value: "4"
          volumeMounts:
            - mountPath: /pgdata
              name: pgdata
            - mountPath: /pgwal
              name: pgwal
      volumes:
        - name: pgdata
          persistentVolumeClaim:
            claimName: pgdata-pvc
        - name: pgwal
          persistentVolumeClaim:
            claimName: pgwal-pvc
