apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres-deployment
  namespace: nestjs
spec:
  replicas: 1
  selector:
    matchLabels:
      component: postgres
  template:
    metadata:
      labels:
        component: postgres
    spec:
      volumes:
      - name: myvol
        persistentVolumeClaim:
          claimName: postgresql-pv-claim
      containers:
      - image: postgres
        name: postgres
        ports:
          - containerPort: 5432
        volumeMounts:
        - name: myvol
          mountPath: /var/lib/postgresql/data
          subPath: postgres
        envFrom:
          - secretRef:
              name: postgres-secret
        # fromEnv:
        #   - name: POSTGRES_PASSWORD
        #     valueFrom:
        #       secretKeyRef:
        #         name: postgres-secret
        #         key: POSTGRES_PASSWORD
        #   - name: POSTGRES_USER
        #     valueFrom:
        #       secretKeyRef:
        #         name: postgres-secret
        #         key: POSTGRES_USER
        #   - name: POSTGRES_DB
        #     valueFrom:
        #       secretKeyRef:
        #         name: postgres-secret
        #         key: POSTGRES_DB