percona / percona-postgresql-operator

Percona Operator for PostgreSQL
https://www.percona.com/doc/kubernetes-operator-for-postgresql/index.html
Apache License 2.0
254 stars 50 forks source link

K8SPG-254: Major upgrade support #789

Closed egegunes closed 3 weeks ago

egegunes commented 1 month ago

K8SPG-254 Powered by Pull Request Badge

CHANGE DESCRIPTION

We add a new CRD called `PerconaPGUpgrade` and a controller to reconcile major upgrades.

In the upstream, user needs to do the following manually to start major upgrades:
1. Pause cluster
2. Annotate cluster with upgrade object name
3. Resume cluster after upgrade is finished

Our controller automates these steps for user.

**Custom extensions**

If user has custom extensions installed in their cluster, we need to
consider them during upgrades. For this user needs to build and package
their custom extension for the major version they want to upgrade.
During upgrade we'll install extensions in the upgrade container using
the same mechanism, by injecting init containers.

**Caveats**

1. `pg_upgrade` duplicates the data in the same PVC for each major
   upgrade. Data for old version is not deleted automatically. That
   means user needs to be sure that their PVC have enough free space to
   store data.
2. If something went wrong with upgrade, cluster will remain paused.
   User needs to delete `PerconaPGUpgrade` object and  resume cluster
   themself to check what went wrong with upgrade.

CHECKLIST

Jira

Tests

Config/Logging/Testability

JNKPercona commented 3 weeks ago
Test name Status
custom-extensions passed
demand-backup passed
init-deploy passed
major-upgrade passed
monitoring passed
one-pod passed
operator-self-healing passed
pitr passed
scaling passed
scheduled-backup passed
self-healing passed
start-from-backup passed
tablespaces passed
telemetry-transfer passed
upgrade-consistency passed
upgrade-minor passed
users passed
We run 17 out of 17

commit: https://github.com/percona/percona-postgresql-operator/pull/789/commits/32c20024e9f84dafe9d8d58136eb4d1d5e381c4c image: perconalab/percona-postgresql-operator:PR-789-32c20024e