zalando / postgres-operator

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

implementing pgpool as optional connection pooler (like pgbouncer) #1105

Open asafo opened 4 years ago

asafo commented 4 years ago

Hello

I would like to implement support for pgpool, much like there is for pgbouncer. Is there any work done in that direction ? Would it be a good idea ? How one should go about doing it from the current code base ?

Thanks

FxKu commented 4 years ago

Not from our side, but the current connection pooler feature is implemented in a way to also allow for other poolers. It all boils down to the docker image one specifies in the configuration. Within this image there should be a lookup function to connect with different users via the pooler service.

Maybe @erthalion can give more insights here on what has to be done from the implementation side?

erthalion commented 4 years ago

Would it be a good idea ?

To make the operator support something new is almost always a good idea.

How one should go about doing it from the current code base ?

As Felix mentioned, the current implementation was designed with the extensibility in mind. Ideally the only thing one need to do is to prepare a different docker image. But I can imagine that there could be some small changes required if e.g. pgpool requires some important configuration passed through which is not exposed at the moment for pgbouncer.

An important thing to not forget is for every extra configuration to think if it requires updates/pod restart. If it is, add it to needSyncConnectionPoolerSpecs/needSyncConnectionPoolerDefaults. Another interesting question would be whether or not to allow switching between pgbouncer to pgpool. This would be probably too troublesome, so my suggestion is to prevent it with an explicit error message in logs.

Other than that, just give it a try!

Jan-M commented 3 years ago

Right now I would also like to read what would be different and why using a different Docker image is not enough.

Now essentially the pooler feature is not more than a deployment that points to a K8s service plus a few variables. That should be pretty good for any other pool.