PgBouncer configuration in Postgres Operator

294 views
Skip to first unread message

Salvatore D'angelo

unread,
Aug 3, 2021, 6:31:42 AM8/3/21
to Postgres Operator
Hi all,

I am trying to add PgBouncer support to my PostgreSQL deployment using CrunchyData operator. My problem is that I am unable to connect to my DB via PgBouncer (I can directly) and the reason seems to be that I don't configure well the users.txt. According to the documentation here:
https://access.crunchydata.com/documentation/postgres-operator/v5/tutorial/connection-pooling/

I need to add the spec.proxy.pgBouncer.config.files but I don't understand exactly how it should be. Here is my piece of code:

  proxy:
    pgBouncer:
      replicas: 2
      config:
        global:
          pool_mode: session
          server_reset_query: DISCARD ALL
          ...
          auth_type: md5
          auth_file: /etc/pgbouncer/users.txt
          ...
        databases:
          'hippo': pool_size=100 reserve_pool=0 pool_mode=session port=5432 user=hippo host=hippo-primary.postgres-operator.svc.cluster.local
        files:
          - 'users.txt'

The documentation says:
Accepts a list of files that are mounted in the /etc/pgbouncer directory and loaded before any other options are considered using PgBouncer’s include directive.

but the syntax above give me:

error: error validating "kustomize/postgres/": error validating data: ValidationError(PostgresCluster.spec.proxy.pgBouncer.config.files[0]): invalid type for com.crunchydata.postgres-operator.v1beta1.PostgresCluster.spec.proxy.pgBouncer.config.files: got "string", expected "map"; if you choose to ignore these errors, turn validation off with --validate=false

I tried to use map, string, whatever but I am not able to figure out the exact syntax and I haven't found any example to address my issue.
Anyone can help?

Salvatore D'angelo

unread,
Aug 3, 2021, 9:06:53 AM8/3/21
to Postgres Operator, Salvatore D'angelo
Forgot to mention that the problem is these lines:

        files:
          - 'users.txt'
Reply all
Reply to author
Forward
0 new messages