apiVersion: apps/v1
kind: Deployment
metadata:
  name: "${SERVICE_NAME}-postgres"
  namespace: "${SERVICE_NAME}"
  labels:
    app: "${SERVICE_NAME}-postgres"
    version: "${POSTGRES_VERSION}"
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: "${SERVICE_NAME}-postgres"
  template:
    metadata:
      labels:
        app: "${SERVICE_NAME}-postgres"
        version: "${POSTGRES_VERSION}"
    spec:
      containers:
        - name: "${SERVICE_NAME}-postgres"
          image: "postgres:${POSTGRES_VERSION}"
          resources:
            limits:
              cpu: 500m
              memory: 250Mi
            requests:
              cpu: 200m
              memory: 150Mi
          ports:
            - name: postgres
              containerPort: 5432
          envFrom:
            - secretRef:
                name: postgres-user
