---
apiVersion: postgresql.cnpg.io/v1
kind: Pooler
metadata:
  name: netbox-postgres-pooler-rw
  namespace: netbox
spec:
  cluster:
    name: netbox-postgres
  instances: 2
  pgbouncer:
    parameters:
      default_pool_size: "50"
      max_client_conn: "200"
    paused: false
    # Session mode: NetBox/Django server-side cursors work unchanged.
    poolMode: session
  template:
    metadata:
      labels:
        app: pooler-rw
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: app
                    operator: In
                    values:
                      - pooler-rw
              topologyKey: kubernetes.io/hostname
      containers: []
  type: rw
