Skip to content

Remove operator checks that prevent PG major version upgrade#1160

Merged
sdudoladov merged 7 commits intomasterfrom
major-version-upgrade
Nov 2, 2020
Merged

Remove operator checks that prevent PG major version upgrade#1160
sdudoladov merged 7 commits intomasterfrom
major-version-upgrade

Conversation

@sdudoladov
Copy link
Member

@sdudoladov sdudoladov commented Oct 7, 2020

UPD 2 I re-tested the PR with the most recent version of the Spilo image that supports major version upgrade. A few minor issues are gone ; the PR is now ready for review.

UPD I will introduce the support of the major version upgrade in a series of smaller PRs

As the first step, this PR:

  1. removes the checks in the operator that prevent major version upgrade and
  2. documents how to manually carry out the upgrade.

We rely on Spilo to start the right PG version. For example, if a manifest - and hence the sts template - has version 12 but the actual cluster was not manually upgraded and still runs version 10, Spilo will still start version 10 despite having

SPILO_CONFIGURATION={"postgresql":{"bin_dir":"/usr/lib/postgresql/12/bin"}

in pod environment.

To do the in-place major upgrade with this pull request:
0. Use / build the Spilo from this PR

IMAGE=test-image
docker build --build-arg PGVERSION=13 -t $IMAGE .
kind load docker-image test-image:latest
  1. Submit a PG manifest, and after the cluster is created, increase the version in the manifest
  2. Wait until the UPDATE event is completely processed. In particular, all pods must successfully start Postgres after the rolling upgrade.
  3. Execute in the master pod
python3  /scripts/inplace_upgrade.py 2

where 2 is the number of pods.

@sdudoladov sdudoladov changed the title [WIP] operator support for the major version upgrade available in Spilo [WIP] remove operator checks that prevent PG major version upgrade Oct 8, 2020
@sdudoladov sdudoladov changed the title [WIP] remove operator checks that prevent PG major version upgrade Remove operator checks that prevent PG major version upgrade Oct 8, 2020
This was referenced Oct 14, 2020
c.Statefulset = sset

// check if there is no Postgres version mismatch
for _, container := range c.Statefulset.Spec.Template.Spec.Containers {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code obsolete?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was initially done to prevent breaking the cluster by altering the PG version. With this PR, increasing a PG version becomes a legitimate operation; decreasing a PG version is still caught with this PR.

@Jan-M
Copy link
Member

Jan-M commented Nov 2, 2020

👍

1 similar comment
@sdudoladov
Copy link
Member Author

👍

@sdudoladov sdudoladov merged commit 4f3bb6a into master Nov 2, 2020
PetterSa pushed a commit to PetterSa/postgres-operator that referenced this pull request Nov 19, 2020
…#1160)

* remove checks that prevent major version upgrade

Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
PetterSa added a commit to PetterSa/postgres-operator that referenced this pull request Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants