postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Hardcoded database

Open lkhomenk opened this issue 7 years ago • 6 comments

Describe the bug Hardcoded database in pgbouncer.ini config - https://github.com/CrunchyData/postgres-operator/blob/89fef9fc325c0645a604fba7c7b41448663bcdda/conf/postgres-operator/cluster/1/pgbouncer.ini#L2

Expected behavior Operator PG_DATABASE should be considered here, but it's ignored

lkhomenk avatar Jan 31 '19 11:01 lkhomenk

Any problem i just replacing dbname=userdb with dbname={{.PG_DATABASE}}?

joaocc avatar Feb 01 '19 19:02 joaocc

It should be also added into pgbouncer.go And if one adds " * = host... " into pgbouncer.ini - > pgo test will fail connectivity test via pgbouncer

lkhomenk avatar Feb 01 '19 20:02 lkhomenk

@lkhomenk , thinking about changing that line in pgbouncer.ini to something like this:

'* = host={{.PG_PRIMARY_SERVICE_NAME}} port={{.PG_PORT}} auth_user={{.PG_USERNAME}}'

Wanted your thoughts on any downside to doing it that way.

flamingdumpster avatar Mar 05 '19 14:03 flamingdumpster

@flamingdumpster, yep I did that. But that way replica service won't be available at least for read-only

lkhomenk avatar Mar 05 '19 18:03 lkhomenk

ok, going to update so that all parameters in that line are configurable through a variable.

flamingdumpster avatar Mar 05 '19 18:03 flamingdumpster

verified on 3.5.2 - now we can use both port and database name in pgbouncer configs! :+1:

lkhomenk avatar Mar 27 '19 16:03 lkhomenk