Skip to main content
Version: Devel

Release notes for CloudNativePG 1.31

History of user-visible changes in the 1.31 minor release of CloudNativePG.

For a complete list of changes, please refer to the commits on the release branch in GitHub.

Version 1.31.0-rc1​

Release date: Nov 25, 2026

Important changes​

Each change below has a section in "Upgrading to 1.31.0" in the documentation.

  • CONNECT is revoked from PUBLIC on the databases created by the operator: new clusters and new databases no longer accept connections from every role. The operator revokes CONNECT from PUBLIC on postgres, template1, and the application database of a cluster bootstrapped with initdb, and on every database created from a Database resource. The cnpg_metrics_exporter role keeps CONNECT on all of them, so monitoring continues to work. The streaming_replica role is granted CONNECT on postgres. Any other role, such as a managed role, must own the database or be granted CONNECT, for example with the .spec.permissions of a Database. Existing databases are never changed, so an operator upgrade does not change any privilege. A cluster bootstrapped with recovery or pg_basebackup is changed only when the operator creates the application database because the source does not have it. A Pooler with a custom authentication method needs CONNECT on postgres for the role that runs its auth_query. Grant it with SQL after the role exists, or set .spec.bootstrap.initdb.allowPublicConnectToPostgres to true to keep CONNECT for PUBLIC on postgres. (#11976)

  • automountServiceAccountToken is disabled on instance Pods: the operator now always sets automountServiceAccountToken: false on instance Pods, the major upgrade Job, and the ServiceAccount it generates. Clusters now comply by default with admission policies that forbid the automatic mounting of the token. The containers that need access to the Kubernetes API get an explicit kube-api-access projected volume. A ServiceAccount supplied through serviceAccountName is not changed. Clusters upgraded from a previous release go through a one-time rolling update. (#11115)

  • Default smartShutdownTimeout is now 0 seconds: the default of .spec.smartShutdownTimeout changed from 180 to 0. New clusters skip the smart shutdown phase and request a fast shutdown (still preceded by a CHECKPOINT) as soon as a PostgreSQL Pod is terminated. The smart phase waits for clients to disconnect. With long-lived application and pooler connections it rarely completes, and it delays node drains and rolling updates. Existing clusters keep the value already stored in their spec. To keep the previous behavior, set .spec.smartShutdownTimeout to 180. (#11944)

  • The legacy synchronous replication configuration is deprecated: the method based on .spec.minSyncReplicas, .spec.maxSyncReplicas, and .spec.postgresql.syncReplicaElectionConstraint is deprecated starting from 1.31.0 and will be removed in 1.33.0. The admission webhook now warns when a cluster uses these fields. Migrate to .spec.postgresql.synchronous. For the same reason, the min and max values of the cnpg_collector_sync_replicas metric are deprecated and will be removed in 1.33.0. (#11978, #11990)

  • Instances are bootstrapped by an init container, not a Job: new primary and replica instances (initdb, recovery, pg_basebackup, join, and snapshot restore) are now bootstrapped by an init container of the instance Pod. The operator no longer creates a separate Job, with its own Pod, for every new instance, and no longer waits for it to complete. A stuck bootstrap is now reported in the Cluster status with the phase Cluster is unrecoverable and needs manual intervention. A replica that resumes a stalled bootstrap reports the phase Creating a new replica, with an event. A Pod restored by a backup tool together with its PVCs does not run the bootstrap again on its data. Tooling that watches the bootstrap Jobs must be updated. (#11319, #11549, #11608, #11801)

  • Online volume snapshot backups no longer include the WAL volume: an online volume snapshot backup of a cluster with a dedicated WAL volume (.spec.walStorage) now includes only PGDATA and the tablespaces, because the recovery of an online backup needs the WAL archive in any case. The restore of such a backup creates an empty WAL volume and fetches the WAL files from the archive, so the recovery needs a source that points to a working WAL archive. Cold backups still include the WAL volume. Existing backups are not affected. (#11734)

  • The status port always uses TLS: all instances have used TLS to communicate with the operator since 1.24, so the HTTP fallback has been removed. This affects you only if some Pods were created by an operator older than 1.24. In that unlikely case, run a manual rolling update of those Pods to recreate them with a TLS-enabled status port. Contributed by @GellertBabel. (#11370, #11946)

  • The observed value of cnpg_collector_sync_replicas has a new meaning: it now counts the standbys attached to the primary in the sync or quorum state, and no longer the number requested in synchronous_standby_names. With quorum-based replication every attached candidate is counted, so observed can be higher than expected. Alerts that compare the two with != must use observed < expected. (#11990)

Features​

  • PostgreSQL 19 support: added support for PostgreSQL 19. The default operand image for new clusters that don't set an image is now 19.0-system-trixie. Existing clusters keep their current image. (#11936)

  • Failover and switchover improvements based on the primary Lease: failover and switchover are more reliable and easier to follow. The changes build on the primary Lease introduced in 1.30.0.

    • Failover:

      • Reduced the failover time when a partitioned primary keeps the WAL receivers waiting: the new primary now counts the leaseDurationSeconds wait from the moment the operator starts the failover, and no longer from the end of the election. (#11798)
      • Changed the primary isolation check to use the primary Lease. The time an isolated primary takes to stop now depends on the .spec.primaryLease timings, like the time a replica waits before it promotes, and no longer on the liveness probe periods. A primary that cannot renew its Lease first tries a fast shutdown, and uses an immediate shutdown only if the fast one does not complete in time. The remaining WAL can then reach the new primary when only the API server was unreachable. (#11357, #11805)
      • Added the detection of replicas that diverged from the timeline of the primary. This can happen when the promoted replica is not the most advanced one. A diverged replica is excluded from the read services, the election, and the failover quorum. It is reported in the new divergedInstances status field, the ReplicasHealthy condition, a ReplicaDiverged event, and the cnpg_collector_replicas_diverged metric. The operator then fences the instance and drops its replication slot on the primary. The instance stays fenced until its PVC is replaced: rebuild the replica with kubectl cnpg destroy CLUSTER INSTANCE. Replica clusters do not report or fence diverged instances. (#11251)
      • Avoided a failover when all the Pods of a cluster are deleted at once. The current primary can start again, and a pending failover is canceled with a FailoverCancelled event. (#11940)
      • Avoided a cluster without a primary when the operator selects a different replica to promote before the first one is promoted. The first replica now stops renewing the primary Lease, so the new one can take it. (#11677)
      • Made a primary stop when another instance reports that the primary was replaced, even when the primary isolation check is disabled. (#11795)
      • Made the liveness probe fail, so that the kubelet restarts the container, when the instance manager hangs or when PostgreSQL is still running .spec.immediateShutdownTimeout seconds after an immediate shutdown request. (#11358)
    • Switchover:

      • Made a switchover wait until the new primary has all the data that the previous primary published on the Lease, in the cnpg.io/position annotation (LSN, timeline, instance state, and Pod). A candidate that is still receiving WAL, for example from the archive, promotes as soon as it has all of it. The instance log and a PromotionHeldBack event on the Cluster report the status and the available options: wait, remove the cnpg.io/position annotation from the Lease to promote without waiting (the replica then promotes without the data that only the previous primary has), or cancel the switchover (see the next item). Failovers, and cases where the position is unknown, are not affected. (#11885, #11932)
      • cnpg plugin: made promote detect a switchover in progress, so that it no longer changes it by accident. To return to the previous primary, cancel the switchover with kubectl cnpg promote --force CLUSTER CURRENT-PRIMARY. (#11956)
  • Export logs via OpenTelemetry without a DaemonSet: the operator, the instance manager, and the PgBouncer instance manager can now send their logs via OTLP (gRPC or HTTP, with TLS and headers) directly to an OpenTelemetry collector. The export is enabled with the standard OTEL_* environment variables. They are read from the operator Deployment, from the env and envFrom of a Cluster (so each cluster can use its own collector), and from the Pod template of a Pooler. PostgreSQL and PGAudit records are exported as structured attributes. The configured log level applies, and the standard output is unchanged. The export never slows down PostgreSQL: records that the collector cannot receive in time are dropped. The queue is flushed before exiting. (#11783)

  • In-place resource resizing of instance Pods: a new .spec.resourcesUpdateStrategy field accepts recreate (the default) or inPlace. With inPlace, when only the container resources of a running Pod change, the operator resizes the Pod through the pods/resize subresource and does not delete it. Nothing restarts, and the primary needs no switchover. The Pod is recreated when the change cannot be applied in place. inPlace requires Kubernetes 1.33 or later. (#11116)

  • Failure domain-aware synchronous replication: added the mutually exclusive podFailureDomainKeys and nodeFailureDomainKeys options to .spec.postgresql.synchronous. They restrict the selection of synchronous standbys to instances in a failure domain (such as an availability zone) different from the one of the primary. An outage of a single zone can then no longer stop the primary and all its synchronous replicas at once. The constraint applies only when it can be fully satisfied. Otherwise the operator uses the regular selection. (#11144)

  • Generated passwords for declarative roles: a DatabaseRole can now include a password stanza, so that the operator generates the password and no existing Secret is required. The password is stored in a kubernetes.io/basic-auth Secret (named <databaserole-name>-password by default), with configurable generation criteria, and with duration and renewBefore for automatic rotation. On a DatabaseRole, the passwordSecret and disablePassword fields still work but are deprecated in favor of the password stanza. A role cannot use both. (#11337)

  • Database privileges in the Database resource: a new .spec.permissions stanza declaratively grants and revokes the CONNECT, CREATE, and TEMPORARY privileges on a database. You no longer need to run SQL scripts after the database is created. You can also revoke CONNECT from public on an existing database and grant it to specific roles. The operator reads the current privileges, runs a GRANT or REVOKE only when needed, and reports the outcome in the status. (#11906)

  • Schema privileges in the Database resource: schema entries in the Database CRD accept a new permissions field to declaratively grant or revoke the USAGE and CREATE privileges on a schema, in addition to the existing owner and ensure management. Contributed by @BRGOVIND. (#10910)

Enhancements​

  • Added an admission webhook warning when a multi-instance cluster has no synchronous replication configured. It explains the durability trade-off of asynchronous replication. (#11148)

  • Added .spec.bootstrap.pg_basebackup.additionalArgs to append custom arguments (for example --max-rate or --checkpoint) to the pg_basebackup command built by the operator. (#11595)

  • Added .spec.bootstrap.pg_basebackup.tablespaceMapping to clone a source instance whose tablespaces are not in the CloudNativePG location. It maps each tablespace declared in .spec.tablespaces to its source path. (#11649)

  • Added optional duration and renewBefore fields to the clientCertificate stanza of a DatabaseRole. Each role can now have its own certificate lifetime and renewal window, different from the operator-wide CERTIFICATE_DURATION and EXPIRING_CHECK_THRESHOLD values. (#11342)

  • Added a set of editor roles for automation: cnpg-editor-role, an aggregate role for the namespaced resources, plus the ImageCatalog, ClusterImageCatalog, and DatabaseRole editor roles. The documentation explains the opt-in aggregation into the built-in edit and admin roles. (#11784)

  • Added the cnpg-viewer-role ClusterRole, with read-only access to the CloudNativePG, Barman Cloud, and Klio API groups, and documented read-only DBA personas with sample RoleBindings. (#11684)

Security and Supply Chain​

  • Signed each architecture-specific manifest of the multi-architecture container images with Cosign, in addition to the multi-architecture index. (#11971)

  • Documented that a user who can write DatabaseRole objects can make the instance ServiceAccount read any Secret of the namespace whose name they know, through password.secret. Give write access to DatabaseRole only to users who are allowed to read those Secrets. (#12010)

  • Hardened the Pooler configuration: newlines and NUL bytes in .spec.pgbouncer.authQuery, in the auth_user name and in the names of .spec.pgbouncer.parameters can no longer inject settings into pgbouncer.ini. A parameter name that cannot be a valid setting is now rejected. (#12011)

Fixes​

  • Fixed an endless rollout loop, and backups that never started, when an admission webhook rewrites the container images of instance Pods, for example to use a registry mirror. The operator now compares the images it rendered, not the live ones. Contributed by @Vince-Chenal. (#12012)

  • Fixed instances stuck forever with a provisioned PVC and no Pod. This could happen to any instance, not only to the first primary, when the operator was interrupted during the bootstrap. (#11142)

  • Fixed a shutdown that sent a signal to an unrelated process when a leftover postmaster.pid contains the PID of a live process that is not PostgreSQL. (#11992)

  • Fixed the min and max values of the cnpg_collector_sync_replicas metric, which were reported as 0 for clusters configured through .spec.postgresql.synchronous. (#11979)

Supported versions​

  • Kubernetes 1.37, 1.36, and 1.35
  • PostgreSQL 19, 18, 17, 16, and 15
    • PostgreSQL 19.0 (19.0-system-trixie) is the default image
    • PostgreSQL 15 support ends on November 11, 2027