Skip to content

[WIP] - Upgrade to postgres 18 - #37

Open
cigamit wants to merge 1 commit into
develfrom
postgres18
Open

[WIP] - Upgrade to postgres 18#37
cigamit wants to merge 1 commit into
develfrom
postgres18

Conversation

@cigamit

@cigamit cigamit commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #36

Summary

Moves the operator-managed PostgreSQL database from 15 to 18 using quay.io/sclorg/postgresql-18-c9s. Existing deployments running a managed PG 13 or 15 database are upgraded automatically on the next reconcile through the operator's existing pg_dump | pg_restore path.

PostgreSQL 15 goes EOL in November 2027; 18 is supported until November 2030. Ascender is on Django 6, which officially supports PostgreSQL 18.

Changes

  • Bump supported_pg_version and _postgres_image to 18 in the installer, backup and restore roles. Backup and restore management pods now use PG 18 client tools.
  • Add the -postgres-15 StatefulSet and Service to the post-upgrade cleanup in upgrade_postgres.yml. Without this the old PG 15 pod would keep running after a 15 → 18 migration.
  • Docs: new Settings introduced in PostgreSQL 16, 17 and 18 section in the database configuration guide, covering the settings most relevant to AWX workloads (io_method, io_workers, transaction_timeout, autovacuum_worker_slots, vacuum_buffer_usage_limit, summarize_wal, etc.) and a warning against io_method = io_uring.
  • Docs: new Upgrading the managed database to PostgreSQL 18 section in the upgrade guide describing the automatic migration and its caveats.
  • Docs: default image references updated to postgresql-18-c9s.

Notes on the issue's caveats

  • Data checksums: not a concern. The operator migrates with dump/restore, not pg_upgrade, so 15 → 18 happens in one step. The new cluster is initialised with checksums on (the PG 18 initdb default).
  • sclorg POSTGRESQL_UPGRADE mode: not used. The 18 image sets POSTGRESQL_PREV_VERSION=16, so its built-in pg_upgrade cannot do 15 → 18 anyway.
  • MD5 auth: the sclorg image writes host all all all md5 to pg_hba.conf, but passwords are stored as SCRAM-SHA-256 verifiers, so clients negotiate SCRAM. PG 18's MD5 deprecation warning only fires when an MD5-hashed password is set.
  • New variables: none added. Every PG 16–18 setting is a postgresql.conf parameter already reachable through postgres_extra_settings.

Follow-ups (not in this PR)

  • postgres_keep_pvc_after_upgrade is documented and defaulted but not referenced by any task (same upstream). Old PVCs are always kept.
  • The sclorg image honours POSTGRESQL_EXTENSIONS on every start; a postgres_extensions CR field would make pg_stat_statements a one-liner.

Testing

  • yamllint on changed YAML
  • Molecule / kind CI
  • Fresh install on PG 18
  • Upgrade of a populated PG 15 managed database to 18 (verify old StatefulSet/Service removed, status.upgradedPostgresVersion: "18")
  • AWXBackup and AWXRestore against the PG 18 database

@cigamit cigamit self-assigned this Sep 9, 2026
Copilot AI lite review requested due to automatic review settings September 9, 2026 19:59
@cigamit cigamit added the enhancement New feature or request label Sep 9, 2026
@ciq-it-service-account

ciq-it-service-account commented Sep 9, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Documentation currently contains a couple of verified inconsistencies/misstatements (stored as PR comments) that should be corrected before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR upgrades the operator-managed PostgreSQL baseline from 15 to 18 (using quay.io/sclorg/postgresql-18-c9s), updates the upgrade cleanup logic to remove legacy PG15 resources after migration, and refreshes documentation to reflect PG18 defaults and new configuration guidance.

Changes:

  • Bump supported_pg_version to 18 and update default/backup/restore PostgreSQL images to postgresql-18-c9s.
  • Extend the post-upgrade cleanup to remove the legacy -postgres-15 StatefulSet and Service after a 15 → 18 migration.
  • Update docs with PG16–18 setting notes and a new managed-database upgrade section.
File summaries
File Description
roles/restore/vars/main.yml Switch restore management pod image and supported PG version to 18.
roles/installer/vars/main.yml Bump installer supported PG version to 18.
roles/installer/tasks/upgrade_postgres.yml Remove old -postgres-15 resources during upgrade cleanup; update upgrade comment.
roles/installer/defaults/main.yml Update default managed PostgreSQL image to PG18.
roles/backup/vars/main.yml Switch backup management pod image and supported PG version to 18.
docs/user-guide/database-configuration.md Update default PG version/docs and add PG16–18 settings guidance; clarify upgrade behavior.
docs/user-guide/advanced-configuration/assigning-awx-pods-to-specific-nodes.md Update documented default postgres_image to PG18.
docs/upgrade/upgrading.md Document automatic managed-database upgrade to PostgreSQL 18 and update examples.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +5 to 7
The default PostgreSQL version for the managed database deployed by the latest version of the awx-operator is PostgreSQL 18, using the `quay.io/sclorg/postgresql-18-c9s` image. You can find this default for a given version at the default value for [supported_pg_version](https://github.com/ctrliq/ascender-operator/blob/devel/roles/installer/vars/main.yml).

We only have coverage for the default version of PostgreSQL. Newer versions of PostgreSQL will likely work, but should only be configured as an external database. If your database is managed by the awx-operator (default if you don't specify a `postgres_configuration_secret`), then you should not override the default version as this may cause issues when awx-operator tries to upgrade your postgresql pod.
We recommend you use the default image sclorg image. If you are coming from a deployment using the old postgres image from dockerhub (postgres:13), upgrading from awx-operator version 2.12.2 and below to 2.15.0+ will handle migrating your data to the new postgresql image (postgresql-15-c9s).
We recommend you use the default sclorg image. The operator automatically migrates a managed database that is still running an older major version (the dockerhub `postgres:13` image, `postgresql-13-c9s` or `postgresql-15-c9s`) to `postgresql-18-c9s` the next time it reconciles the deployment. See [PostgreSQL Upgrade Considerations](../upgrade/upgrading.md#postgresql-upgrade-considerations) for what happens during that migration.

You can no longer configure a custom `postgres_data_path` because it is hardcoded in the quay.io/sclorg/postgresql-18-c9s image.
# * If postgres version is not supported_pg_version, and not an external postgres instance (when managed_database is yes),
# then run this playbook with include_tasks from database_configuration.yml
# * Data will be streamed via a pg_dump from the postgres 12/13 pod to the postgres supported_pg_version
# * Data will be streamed via a pg_dump from the old postgres (12/13/15) pod to the postgres supported_pg_version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

Postgres 18 Upgrade

3 participants