K8SPG-1051 add pg 19 - #1699
Conversation
47cf684
There was a problem hiding this comment.
Pull request overview
Adds PostgreSQL 19 (beta) “tech preview” support to the Percona PostgreSQL Operator by widening CRD validation bounds to 19, adding a safety validation to prevent enabling extensions without available PG19 beta packages, and introducing an E2E major-upgrade suite for 18→19 along with release image plumbing.
Changes:
- Bump CRD/schema validation maximums for PostgreSQL versions to 19 (and upgrade bounds accordingly).
- Add
PerconaPGCluster.Validate()guard to block enablingpg_cronandset_userfor PG 19 beta. - Add
major-upgrade-18-to-19KUTTL E2E suite plus release image variables for PG19 components.
Reviewed changes
Copilot reviewed 33 out of 35 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/apis/upstream.pgv2.percona.com/v1beta1/postgrescluster_types.go | Raise upstream PostgresCluster postgresVersion maximum validation to 19. |
| pkg/apis/upstream.pgv2.percona.com/v1beta1/pgupgrade_types.go | Raise upstream PGUpgrade toPostgresVersion maximum validation to 19. |
| pkg/apis/pgv2.percona.com/v2/perconapgupgrade_types.go | Extend Percona PGUpgrade version bounds to allow 18→19 upgrades. |
| pkg/apis/pgv2.percona.com/v2/perconapgcluster_types.go | Allow PG19 in spec and add PG19 beta extension enablement validation. |
| Makefile | Teach after-release-versions to maintain PG19 image variables. |
| e2e-tests/tests/major-upgrade-18-to-19/conf/major-upgrade-18-to-19.yaml | Suite config for the new 18→19 major-upgrade test. |
| e2e-tests/tests/major-upgrade-18-to-19/00-deploy-operator.yaml | Deploy operator/client/secrets for the 18→19 suite. |
| e2e-tests/tests/major-upgrade-18-to-19/00-assert.yaml | Assert operator/CRD readiness for the 18→19 suite. |
| e2e-tests/tests/major-upgrade-18-to-19/01-create-cluster.yaml | Create initial PG18 cluster and configure pg_cron for pre-upgrade. |
| e2e-tests/tests/major-upgrade-18-to-19/01-assert.yaml | Assert initial cluster resources are ready. |
| e2e-tests/tests/major-upgrade-18-to-19/02-write-data.yaml | Seed data and create extension before upgrade. |
| e2e-tests/tests/major-upgrade-18-to-19/03-read-from-primary.yaml | Read data pre-upgrade and persist as ConfigMap. |
| e2e-tests/tests/major-upgrade-18-to-19/03-assert.yaml | Assert pre-upgrade read output. |
| e2e-tests/tests/major-upgrade-18-to-19/04-upgrade.yaml | Trigger PerconaPGUpgrade from 18 to 19 with PG19 images. |
| e2e-tests/tests/major-upgrade-18-to-19/04-assert.yaml | Assert upgrade succeeded and cluster reports PG19. |
| e2e-tests/tests/major-upgrade-18-to-19/05-post-upgrade.yaml | Run post-upgrade maintenance tasks and cleanup script. |
| e2e-tests/tests/major-upgrade-18-to-19/06-write-data.yaml | Write additional data post-upgrade. |
| e2e-tests/tests/major-upgrade-18-to-19/07-run-backup.yaml | Trigger a manual full backup post-upgrade. |
| e2e-tests/tests/major-upgrade-18-to-19/07-assert.yaml | Assert backup job + CR succeeded. |
| e2e-tests/tests/major-upgrade-18-to-19/09-write-data.yaml | Write more data after backup. |
| e2e-tests/tests/major-upgrade-18-to-19/10-run-restore.yaml | Trigger restore after upgrade flow. |
| e2e-tests/tests/major-upgrade-18-to-19/10-assert.yaml | Assert restore succeeded and cluster health signals are ready. |
| e2e-tests/tests/major-upgrade-18-to-19/11-read-from-primary.yaml | Read data after restore and persist as ConfigMap. |
| e2e-tests/tests/major-upgrade-18-to-19/11-assert.yaml | Assert post-restore data includes all expected rows. |
| e2e-tests/tests/major-upgrade-18-to-19/99-remove-cluster-gracefully.yaml | Cleanup test resources and ensure operator stability. |
| e2e-tests/run-release.csv | Add 18→19 suite to release test run list. |
| e2e-tests/release_versions | Add PG19 image variables for release test runs. |
| deploy/cw-bundle.yaml | Regenerated bundle YAML reflecting PG19 schema bounds. |
| deploy/crd.yaml | Regenerated CRD YAML reflecting PG19 schema bounds. |
| deploy/bundle.yaml | Regenerated bundle YAML reflecting PG19 schema bounds. |
| config/crd/bases/upstream.pgv2.percona.com_postgresclusters.yaml | Raise upstream PostgresCluster CRD maximum to 19. |
| config/crd/bases/upstream.pgv2.percona.com_pgupgrades.yaml | Raise upstream PGUpgrade CRD maximum to 19. |
| config/crd/bases/pgv2.percona.com_perconapgclusters.yaml | Raise PerconaPGCluster CRD maximum to 19 and upgrade bounds accordingly. |
| build/crd/percona/generated/pgv2.percona.com_perconapgupgrades.yaml | Regenerated PerconaPGUpgrade CRD with updated bounds. |
| build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml | Regenerated PerconaPGCluster CRD with updated bounds. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if ptr.Deref(ext.enabled, false) { | ||
| return errors.Errorf("spec.extensions.%s.enabled cannot be set for PostgreSQL %d: extension packages are not built for beta releases", ext.name, cr.Spec.PostgresVersion) | ||
| } |
| // Extension packages are not built for PostgreSQL 19 (beta) yet; loading them | ||
| // via shared_preload_libraries would make postgres fail to start. | ||
| // pgAudit is the exception: the PG 19 community image compiles it from source. | ||
| // Remove this check once PostgreSQL 19 goes GA and the extensions are available. | ||
| if cr.Spec.PostgresVersion >= 19 { | ||
| for _, ext := range []struct { | ||
| name string | ||
| enabled *bool | ||
| }{ | ||
| {"pg_cron", cr.Spec.Extensions.PGCron.Enabled}, | ||
| {"set_user", cr.Spec.Extensions.SetUser.Enabled}, | ||
| } { | ||
| if ptr.Deref(ext.enabled, false) { | ||
| return errors.Errorf("spec.extensions.%s.enabled cannot be set for PostgreSQL %d: extension packages are not built for beta releases", ext.name, cr.Spec.PostgresVersion) | ||
| } | ||
| } | ||
| } |
3e24bdb
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 36 changed files in this pull request and generated no new comments.
Suppressed comments (3)
pkg/apis/pgv2.percona.com/v2/perconapgcluster_types.go:513
-
- Problem: This validation blocks
spec.extensions.pg_cron.enabled/spec.extensions.set_user.enabledfor PG19+, but it still allows the same unsupported extensions to be requested viaspec.extensions.custom, which will likely still lead to missing packages and a failing PostgreSQL start.
- Problem: This validation blocks
- Why it matters: Users (and the new major-upgrade-18-to-19 KUTTL suite) can bypass the intended block and hit runtime failures instead of getting a clear validation error.
- Fix: Also reject
spec.extensions.customentries with namespg_cronandset_userwhenspec.postgresVersion >= 19.
e2e-tests/tests/major-upgrade-18-to-19/02-write-data.yaml:20
-
- Problem: This step creates the
pg_cronextension, but the PR description statespg_cronis blocked for PostgreSQL 19 beta due to missing packages.
- Problem: This step creates the
- Why it matters: Keeping
pg_croninstalled/required prior to upgrading to PG19 can prevent the upgraded PostgreSQL from starting. - Fix: Remove this
CREATE EXTENSION pg_cronstep from the PG18→PG19 suite (or replace it with an extension supported on PG19 beta).
run_psql_local \
'\c postgres \\\ CREATE EXTENSION pg_cron' \
"postgres:$(get_psql_user_pass major-upgrade-18-to-19-pguser-postgres)@$(get_psql_user_host major-upgrade-18-to-19-pguser-postgres)"
e2e-tests/tests/major-upgrade-18-to-19/01-create-cluster.yaml:24
-
- Problem: This suite enables
pg_cronviashared_preload_librariesandspec.extensions.custom, but the PR description and webhook validation indicatepg_cronpackages are not available for PostgreSQL 19 beta.
- Problem: This suite enables
- Why it matters: After the upgrade to PG19, PostgreSQL is likely to fail to start if
pg_cronremains inshared_preload_libraries. - Fix: Remove the
pg_cronpreload/custom-extension configuration from this PG18→PG19 upgrade suite (or switch to an extension known to be available on PG19 beta, e.g. pgAudit).
.spec.patroni.removeDataDirectoryOnDivergedTimelines = true |
.spec.patroni.dynamicConfiguration.postgresql.parameters.shared_preload_libraries = \"pg_cron\" |
.spec.extensions.custom += [{\"name\": \"pg_cron\", \"version\": \"1.6.6\"}]" \
hors
left a comment
There was a problem hiding this comment.
@nmarukovich please check major-upgrade-18-to-19 test
on it. |
| # This row is written after the last backup, so the restore in step 10 | ||
| # can only bring it back by replaying it from the WAL archive. Until the | ||
| # segment holding it is archived it exists only in pg_wal, and archiving | ||
| # it is otherwise left to archive_timeout (1 minute) — which the restore | ||
| # regularly outruns. Force the switch so the row is archived right away. | ||
| run_psql_local \ | ||
| 'SELECT pg_switch_wal()' \ | ||
| "postgres:$(get_psql_user_pass major-upgrade-18-to-19-pguser-postgres)@$(get_psql_user_host major-upgrade-18-to-19-pguser-postgres)" |
There was a problem hiding this comment.
i'm curious why we need this, and why only for PG19?
There was a problem hiding this comment.
Yesterday on one of the runs I saw that the data written after the backup didn't make it into the restored cluster. I thought the cluster gets stopped before that data reaches the archive, and this addition would guarantee it always makes it.
But I checked the logs again today and saw that the last WAL segment is pushed to the archive during shutdown, before Postgres exits. Correct? So this check is not needed, I'll remove it.
Thanks @egegunes nice catch! ❤️
logger.go:42: 16:44:23 | major-upgrade-18-to-19/11-read-from-primary | test step failed 11-read-from-primary
case.go:328: failed in step 11-read-from-primary
case.go:330: --- ConfigMap:kuttl-test-informed-gorilla/11-read-from-primary
+++ ConfigMap:kuttl-test-informed-gorilla/11-read-from-primary
@@ -3,9 +3,9 @@
data: |2-
100500
100501
- 100502
kind: ConfigMap
metadata:
+ managedFields: '[... elided field over 10 lines long ...]'
name: 11-read-from-primary
namespace: kuttl-test-informed-gorilla
commit: 2bd7f8c |
CHANGE DESCRIPTION
Problem:
Add PostgreSQL 19 (beta) support as tech preview: CRD bounds bumped to 19, major-upgrade-18-to-19 e2e suite added, pg_cron/set_user blocked for 19 (no beta packages). Requires pgBackRest 2.59.
https://cloud.cd.percona.com/job/pg-community-docker-build/
https://github.com/Percona-Lab/jenkins-pipelines/pull/4302/changes
percona/percona-docker#1373
Cause:
Short explanation of the root cause of the issue if applicable.
Solution:
Short explanation of the solution we are providing with this PR.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability