apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: komodo-postgresql-17-fdb-cluster
  namespace: komodo
  labels:
    app.kubernetes.io/name: komodo-postgresql-17-fdb-cluster
    helm.sh/chart: postgresql-17-fdb-cluster-7.15.0
    app.kubernetes.io/instance: komodo
    app.kubernetes.io/part-of: komodo
    app.kubernetes.io/version: "7.15.0"
    app.kubernetes.io/managed-by: Helm
spec:
  instances: 3
  imageName: "ghcr.io/ferretdb/postgres-documentdb:17-0.107.0-ferretdb-2.7.0@sha256:2386795ec2aa7ae559304361979f1dc5708d383ee9020ae63dadc2940dfe58f7"
  imagePullPolicy: IfNotPresent
  postgresUID: 999
  postgresGID: 999
  storage:
    size: 10Gi
    storageClass: local-path
  walStorage:
    size: 2Gi
    storageClass: local-path
  resources:
    limits:
      hugepages-2Mi: 256Mi
    requests:
      cpu: 50m
      memory: 512Mi
  affinity:
    enablePodAntiAffinity: true
    topologyKey: kubernetes.io/hostname
  primaryUpdateMethod: switchover
  primaryUpdateStrategy: unsupervised
  logLevel: info
  enableSuperuserAccess: false
  enablePDB: true
  postgresql:
    shared_preload_libraries:
      - pg_cron
      - pg_documentdb_core
      - pg_documentdb
    pg_hba:
      - host ferretDB postgres localhost trust
      - host ferretDB ferret localhost trust
    parameters:
      cron.database_name: ferretDB
      documentdb.enableBypassDocumentValidation: "true"
      documentdb.enableCompact: "true"
      documentdb.enableLetAndCollationForQueryMatch: "true"
      documentdb.enableNowSystemVariable: "true"
      documentdb.enableSchemaValidation: "true"
      documentdb.enableSortbyIdPushDownToPrimaryKey: "true"
      documentdb.enableUserCrud: "true"
      documentdb.maxUserLimit: "100"
      hot_standby_feedback: "on"
      max_slot_wal_keep_size: 2000MB
      shared_buffers: 512MB
  monitoring:
    enablePodMonitor: false
    disableDefaultQueries: false
  plugins:
    - name: barman-cloud.cloudnative-pg.io
      enabled: true
      isWALArchiver: true
      parameters:
        barmanObjectName: "komodo-postgresql-17-fdb-backup-garage-local"
        serverName: "komodo-postgresql-17-fdb-backup-2"
  bootstrap:
    recovery:
      database: app
      source: komodo-postgresql-17-fdb-backup-2
  externalClusters:
    - name: komodo-postgresql-17-fdb-backup-2
      plugin:
        name: barman-cloud.cloudnative-pg.io
        enabled: true
        isWALArchiver: false
        parameters:
          barmanObjectName: "komodo-postgresql-17-fdb-recovery"
          serverName: komodo-postgresql-17-fdb-backup-2
