apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-relational-database
  labels:
    project: sob
    app: api-relational-database
    layer: api
spec:
  revisionHistoryLimit: 2
  replicas: 1
  selector:
    matchLabels:
      app: api-relational-database
  template:
    metadata:
      labels:
        project: sob
        app: api-relational-database
        layer: api
    spec:
      containers:
        - name: api-relational-database
          image: postgres:13
          imagePullPolicy: Always
          ports:
            - containerPort: 5432
          env:
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  name: sob-secret
                  key: api-relational-database-user
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: sob-secret
                  key: api-relational-database-password
          volumeMounts:
            - name: api-relational-database-storage
              mountPath: /var/lib/postgresql/data
              subPath: postgres-data
          resources:
            limits:
              cpu: "100m"
              memory: "256Mi"
            requests:
              cpu: "1m"
              memory: "128Mi"
      volumes:
        - name: api-relational-database-storage
          persistentVolumeClaim:
            claimName: api-relational-database-pvc
