Skip to content

K8SPG-1114: Automate deploying logical replicas - #1747

Merged
egegunes merged 12 commits into
mainfrom
K8SPG-1114
Aug 18, 2026
Merged

K8SPG-1114: Automate deploying logical replicas#1747
egegunes merged 12 commits into
mainfrom
K8SPG-1114

Conversation

@egegunes

@egegunes egegunes commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

CHANGE DESCRIPTION

This PR adds support for deploying logical replicas.

  spec:
    logicalReplicas:
    - name: logical
      databases:
      - mydb  # empty -> all non-template DBs except "postgres"
      bootstrapMethod: pgbackrest  # or pg_basebackup (default: pgbackrest)
      dataVolumeClaimSpec: {...}
      ...
  • Creating the logical replica depends on pg_createsubscriber, so this feature is PG17+ only.
  • Operator creates a new user logicalrepl with options SUPERUSER REPLICATION if a logical replica is defined in cr.yaml. logicalrepl is now a reserved user name.
  • Primary failovers break logical replication because replication slots live only on the node that created them. use_slots is false by default but now it's overridable, user can define slots in patroni configuration to ensure they survive failover. If logical replication is broken due to failover, it's reflected in the status.
  • Restores invalidate logical replicas and user needs to reseed them. Reseeding means deleting it from cr.yaml and re-adding.
  • Deleting a logical replica always deletes its PVC.
  • Operator communicates the replica status in status.logicalReplicas[].
    state: bootstrapping|ready|broken|suspended, plus reason, message, databases, seededAt, invalidatedAt.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants