Good idea!! I’ll try that now.
There may be another way that is baked into pgbouncer. The /docs/content/tutorial/connection-pooling.md file (in the repo) describes a way to change cr.yaml to inject other databases into pgbouncer.ini. It says:
There are several ways you can customize the configuration:
spec.proxy.pgBouncer.config.global
: Accepts key-value pairs that apply changes globally to PgBouncer.spec.proxy.pgBouncer.config.databases
: Accepts key-value pairs that represent PgBouncer database definitions.
I believe this means that we can add a spec.proxy.pgBouncer.config.databases section to cr.yaml something like this:
spec:
proxy:
pgBouncer:
config:
databases:
- developer: "host=pg-cluster1-ha port=5432"
but this did not work. Applying cr.yaml did not generate a cluster so I am sure that I got the syntax wrong.
The online docs do not show this option: Custom Resource options - Percona Operator for PostgreSQL so perhaps it is something new or perhaps they have not got around to properly implementing it yet. Once configured/working it should allow us to define our own, specific database / host mappings in pgbouncer.ini
I have also posted this question here: Pgbouncer not finding cluster1-primary - PostgreSQL - Percona Community Forum
Seems strange that I independently ran into the same issue twice when approaching deployment in 2 different ways. I wonder why they have not dealt with it yet. I raised this issue way back in January!
Does anyone here know how to raise this as a bug report on Jira? The existing issue is marked for resolution on version 1.4 so I’m not sure that it will be addressed on version 2. I have tried signing up for an account on Percona Jira but it does not seem to work.