#@ load("@ytt:data", "data")

#@ ns = data.values.application.namespace

---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: synapse-cnpg
  namespace: #@ ns
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
spec:
  instances: 1

  bootstrap:
    initdb:
      database: synapse
      owner: synapse
      localeCollate: C
      localeCType: C

  storage:
    size: 5Gi
    storageClass: #@ data.values.cluster.storageClass.block

  resources:
    requests:
      cpu: 50m
      memory: 64Mi
    limits:
      memory: 128Mi

  postgresql:
    parameters:
      shared_buffers: "32MB"
      effective_cache_size: "96MB"
      work_mem: "4MB"
      maintenance_work_mem: "32MB"
      max_connections: "30"
