Skip to content

PostgreSQL addon: expose pgbouncer (pgbouncer.ini) tunables via Reconfiguring / cluster API #2555

@weicao

Description

@weicao

Problem

Today the PostgreSQL addon ships a per-pod pgbouncer sidecar (port 6432) using addons/postgresql/config/pgbouncer-ini.tpl mounted as pgbouncer-configuration. Operators often need to tune pool sizing (default_pool_size, related pool limits) and other pgbouncer.ini settings for workload shape and connection storms.

KubeBlocks Reconfiguring OpsRequest only targets postgresql.conf (see templates/paramsdef.yaml: fileName: postgresql.conf). The pgbouncer-configuration config entry in templates/cmpd.yaml has no reconfigure action (unlike postgresql-configuration, which includes postgresql.config.reconfigureAction).

So users cannot adjust pgbouncer via the cluster API after deployment; default_pool_size is not even set in the template, so PgBouncer default (20) applies. That is a real product gap (documented as such in kubeblocks-docs PostgreSQL FAQ §7).

Desired behavior

  • First-class support to change pgbouncer parameters (at minimum: default_pool_size, ideally pool_mode, max_client_conn override, and other common pgbouncer.ini keys) without forking the chart for every cluster.
  • Consistent UX with engine reconfiguration: e.g. OpsRequest type Reconfiguring (or a dedicated operation) with validated parameters and clear reload vs restart semantics for the pgbouncer container.

Suggested implementation sketch

  1. Add a parameters definition / schema for pgbouncer.ini (properties format or dedicated constraint), or extend the component config model so pgbouncer keys are valid reconfigures[].parameters for component postgresql.
  2. Attach reconfigure lifecycle to pgbouncer-configuration in ComponentDefinition (reload pgbouncer or restart sidecar as appropriate—Bitnami images often support SIGHUP reload for many settings).
  3. Ensure generated pgbouncer.ini merges user overrides with templated values (memory-based max_client_conn, etc.).
  4. Tests / examples: sample OpsRequest and kbcli path if applicable.

References

  • addons/postgresql/templates/cmpd.yamlconfigs for postgresql-configuration vs pgbouncer-configuration
  • addons/postgresql/templates/paramsdef.yamlpostgresql.conf only
  • addons/postgresql/config/pgbouncer-ini.tpl — current template

If this belongs in the main kubeblocks repo instead (core reconfiguring API), please move/relabel; the addon change still needs the pgbouncer config + reload wiring above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions