Skip to content

[Feature]: Warn when a multi-instance cluster has no synchronous replication configured #11180

Description

@gbartolini

Is there an existing issue already for this feature request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

A multi-instance Cluster with no synchronous replication configured (neither .spec.postgresql.synchronous nor the legacy .spec.minSyncReplicas) runs in fully asynchronous mode by default. This is silently accepted at apply time: nothing tells the user that a primary failure can lose any transaction not yet shipped to a standby. Users who deploy a multi-instance cluster expecting HA often assume replication implies durability, and discover the gap only after an incident.

Describe the solution you'd like

Add an admission webhook warning, emitted at apply/create/update time, when:

  • .spec.instances >= 2, and
  • .spec.postgresql.synchronous is unset, and
  • .spec.minSyncReplicas is 0 (legacy API not configured)

The warning message should explain the risk (data loss for unreplicated transactions on primary failure) and point at .spec.postgresql.synchronous as the fix. The warning must be suppressed as soon as either the current or the legacy synchronous replication API is configured, so it never fires for clusters that made an explicit, informed choice (including an explicit choice to run async-only).

Describe alternatives you've considered

  • Reject cluster creation outright instead of warning — rejected, since fully-async multi-instance clusters are a legitimate configuration for some workloads (e.g. read-scaling with relaxed durability); this shouldn't become a hard validation error.
  • Surface the risk only via documentation — rejected, as it doesn't reach users at the moment the decision is made (apply time), which is exactly where a warning is most actionable.
  • Emit a Cluster status condition instead of/in addition to a webhook warning — worth considering as a follow-up so the risk stays visible after the initial apply (e.g. in kubectl get clusters -o wide or kubectl cnpg status), not just at the terminal at creation time.

Additional context

An initial implementation was drafted and then reverted out of the failure-domain PR to keep that PR focused; see that PR's history for a working reference (webhook check + getSynchronousReplicationWarnings helper + tests) that can be reused/adapted. Needs care around the end-to-end webhook test suite, since a naive version of this warning fired for any multi-instance cluster using default configuration, which broke existing e2e expectations — the design needs to account for existing tests/samples that intentionally omit synchronous replication.

Backport?

Yes

Are you willing to actively contribute to this feature?

Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added this to the 1.30.1 milestone on Jul 14, 2026
  2. self-assigned this
    on Jul 14, 2026
  3. added
    enhancement 🪄
    on Jul 14, 2026
  4. added a commit that references this issue on Jul 23, 2026
    0552b9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement 🪄

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions