Honor disableConnectionPooling in the SGClusters of an SGShardedCluster with connectToPooler set to true

Summary

When SGShardedCluster.spec.configurations.citus.connectToPooler is true (the default) the operator sets disableConnectionPooling: false on every generated SGCluster (coordinator, workers, query routers and their overrides), ignoring what the manifest says. On an existing manifest that disabled pooling this silently:

  • adds a pgbouncer container to every Pod, taking its CPU and memory requests out of the patroni container ones;
  • makes the port 5432 of the primary Service target PgBouncer, so clients that reached Postgres directly are now pooled.

Proposed solution

Honor disableConnectionPooling (.spec.coordinator.pods, .spec.workers.pods, .spec.workers.overrides[].pods) in every generated SGCluster regardless of connectToPooler. When connectToPooler is true and a node has disableConnectionPooling: true:

  • PgBouncer is not created in the Pods of its SGCluster;
  • its group is not added to pg_dist_poolinfo (any entry created by the coordinator for it is removed), so Citus connects to it directly through the Postgres port.

Update the CRD description of connectToPooler and the citus sharding technology documentation accordingly.