percona-postgresql-operator
percona-postgresql-operator copied to clipboard
K8SPG-217: Fix missing primary deployment after restore
The problem only occurs if primary is failed over to a replica before the restore.
The operator stores the current primary in an annotation of pgcluster
(i.e. current-primary: cluster1). After the bootstrap finishes,
operator creates the primary deployment using this value as the
deployment name. After the primary is created, it proceeds to create
replica deployments.
If a failover is performed and a replica deployment is promoted to
primary, the operator updates the annotation (i.e. current-primary: cluster1-repl2).
If a restore is started at this moment in the cluster:
- Bootstrap finishes
- Operator creates
cluster1-repl2as the primary deployment - Operator creates
Pgreplicaobjects,cluster1-repl1is created butcluster1-repl2is skipped since it already exists
This commit updates the current-primary annotation with cluster name
just before the restore, so restore is performed on PVC cluster1 and
replicas are created as expected.
| Test name | Status |
|---|---|
| demand-backup | passed |
| scheduled-backup | passed |
| version-service | passed |
| init-deploy | passed |
| upgrade | passed |
| smart-update | passed |
| scaling | passed |
| recreate | passed |
| affinity | passed |
| monitoring | passed |
| self-healing | passed |
| operator-self-healing | passed |
| clone-cluster | passed |
| tls-check | passed |
| users | passed |
| ns-mode | passed |
| We run 16 out of 16 |
commit: https://github.com/percona/percona-postgresql-operator/pull/295/commits/5516942628ea4933f2d827cbda1c297257b5c6ef
image: perconalab/percona-postgresql-operator:PR-295-55169426-pgo-apiserver
image: perconalab/percona-postgresql-operator:PR-295-55169426-pgo-event
image: perconalab/percona-postgresql-operator:PR-295-55169426-pgo-rmdata
image: perconalab/percona-postgresql-operator:PR-295-55169426-pgo-scheduler
image: perconalab/percona-postgresql-operator:PR-295-55169426-postgres-operator
image: perconalab/percona-postgresql-operator:PR-295-55169426-pgo-deployer