apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: shared-pg
  namespace: cnpg
spec:
  instances: 3
  imageName: ghcr.io/cloudnative-pg/postgresql:16

  resources:
    requests:
      memory: 1Gi
      cpu: 250m
    limits:
      memory: 2Gi
      cpu: 1000m

  storage:
    size: 20Gi
    storageClass: yc-network-ssd

  affinity:
    podAntiAffinityType: required

  bootstrap:
    initdb:
      database: postgres
      owner: postgres

  postgresql:
    parameters:
      shared_buffers: "512MB"
      effective_cache_size: "1536MB"
      maintenance_work_mem: "64MB"
      max_connections: "200"
      work_mem: "16MB"
      random_page_cost: "1.1"
      effective_io_concurrency: "200"

  monitoring:
    enablePodMonitor: true
