zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.22k stars 968 forks source link

operator allow to create cluster with TLS disabled but pooler - not #2620

Open baznikin opened 4 months ago

baznikin commented 4 months ago

Operator allow to create cluster without enforced secure connections, but bundled pgBouncer enforce it.

We set ALLOW_NOSSL: "true" for our clusters via ConfigMap and now we want to use connection pooler. However it is enforce secure connections:

server_tls_sslmode = require
server_tls_ca_file = /etc/ssl/certs/pgbouncer.crt
server_tls_protocols = secure
client_tls_sslmode = require

Please, make it configurable or allow insecure connections with looser restrictions:

server_tls_sslmode = prefer
client_tls_sslmode = prefer

It is backward compatible with existent configurations and do not harm anyone

vadimsabynich-flant commented 2 months ago

Hello! This is really useful settings for configuration application's connection to pgbouncer much fluently.

kamenskiyyyy commented 21 hours ago

I fixed this using a custom docker image

FROM registry.opensource.zalan.do/acid/pgbouncer:master-32

RUN sed -i '/#/!s/\(server_tls_sslmode[[:space:]]*=[[:space:]]*\)\(.*\)/\1prefer/' /etc/pgbouncer/pgbouncer.ini.tmpl
RUN sed -i '/#/!s/\(client_tls_sslmode[[:space:]]*=[[:space:]]*\)\(.*\)/\1prefer/' /etc/pgbouncer/pgbouncer.ini.tmpl

values.yaml

configConnectionPooler:
  connection_pooler_image: registry.local/pgbouncer:master-32.2