Upstream 2071 - Add postgres_extra_settings for postgresql.conf overrides - #30
Merged
Merged
Conversation
…ides Adds a postgres_extra_settings field to the AWX CRD. When set, the operator renders a ConfigMap of postgresql.conf overrides and mounts it into the managed postgres pod, superseding the deprecated postgres_extra_args. The upstream change targets roles/installer/tasks/database.yml, which this fork does not have; its contents live in database_configuration.yml here. The ConfigMap task is placed at the matching point, after the database configuration facts are set and before the statefulset that mounts it. Ports ansible/awx-operator#2071.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for managing postgresql.conf overrides for the managed PostgreSQL instance via a new spec.postgres_extra_settings field on the AWX CRD. This introduces a rendered ConfigMap containing override snippets and mounts it into the managed Postgres pod, while marking the legacy postgres_extra_args as deprecated.
Changes:
- Add
spec.postgres_extra_settingsto the AWX CRD and OLM CSV, and deprecatepostgres_extra_args. - Render a
postgres-extra-settingsConfigMap and mount it into the managed Postgres StatefulSet, triggering rollouts via checksum annotation. - Document the new field and update the Molecule example CR.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| roles/installer/templates/statefulsets/postgres.yaml.j2 | Mounts the overrides ConfigMap and adds a checksum annotation to roll pods on changes. |
| roles/installer/templates/configmaps/postgres_extra_settings.yaml.j2 | New template to render postgresql.conf override lines into a ConfigMap. |
| roles/installer/tasks/database_configuration.yml | Applies the new ConfigMap during DB configuration. |
| roles/installer/defaults/main.yml | Deprecation note for postgres_extra_args and default for postgres_extra_settings. |
| molecule/default/templates/awx_cr_molecule.yml.j2 | Adds example postgres_extra_settings to the Molecule CR template. |
| docs/user-guide/database-configuration.md | Documents postgres_extra_settings and deprecates postgres_extra_args. |
| config/manifests/bases/awx-operator.clusterserviceversion.yaml | Exposes the new field in CSV descriptors and marks args deprecated. |
| config/crd/bases/awx.ansible.com_awxs.yaml | Adds the new CRD schema for postgres_extra_settings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+10
to
+16
| {% for pg_setting in postgres_extra_settings %} | ||
| {% if pg_setting.value is string %} | ||
| {{ pg_setting.setting }} = '{{ pg_setting.value }}' | ||
| {% else %} | ||
| {{ pg_setting.setting }} = {{ pg_setting.value }} | ||
| {% endif %} | ||
| {% endfor %} |
| k8s: | ||
| apply: true | ||
| definition: "{{ lookup('template', 'configmaps/postgres_extra_settings.yaml.j2') }}" | ||
| when: postgres_extra_settings | length |
Comment on lines
+142
to
+144
| - String values should be quoted in the YAML configuration. | ||
| - Numeric values can be provided as strings or numbers. | ||
| - Boolean values should be provided as strings ("on"/"off" or "true"/"false"). |
The CRD types value as a string, so the numeric branch in the ConfigMap template was unreachable and a value containing a single quote rendered an invalid postgresql.conf line. Values are now always rendered quoted, with embedded single quotes doubled. The ConfigMap was also created for external databases, where nothing mounts it, so its creation is now gated on managed_database, and the docs no longer suggest numeric values may be passed unquoted.
Contributor
Author
|
All three review comments are addressed in be84aed.
|
cigamit
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream PR: ansible/awx-operator#2071
SUMMARY
Adds a
postgres_extra_settingsfield to theAWXCRD. When set, the operator renders a ConfigMap ofpostgresql.confoverrides and mounts it into the managed postgres pod:This supersedes
postgres_extra_args, which upstream marks deprecated in the same change. That variable exists in this fork too, so the deprecation note applies as written.Every template hunk is gated on
postgres_extra_settings | length > 0, so with the field unset the rendered StatefulSet is unchanged.ADDITIONAL INFORMATION
This one needed real adaptation rather than a clean cherry-pick, so the deviations from upstream are worth stating up front.
Task layout. Upstream applies the ConfigMap in
roles/installer/tasks/database.yml. This fork has no such file — upstream split it out after the fork point, and its contents are still insidedatabase_configuration.ymlhere (the two files' tails are identical). I placed the task at the equivalent point: immediately afterSet database as managed, which is where upstream's ordering puts it relative to the surrounding tasks, and well before the statefulset that mounts the ConfigMap is applied.Dropped from the upstream hunk. The conflicting hunk in
statefulsets/postgres.yaml.j2bundled two things belonging to other upstream changes:postgres_annotations(from #1829) — not ported to this fork, andpostgres_annotationsis not defined inroles/installer/defaults/main.yml. Taking it verbatim would have put an undefined variable into the postgres StatefulSet template for every managed-database deploy.checksum-secret-postgres_configuration_secret— unrelated to this feature.I kept only the
checksum-postgres_extra_settingsannotation this feature needs, and wrappedannotations:inside the same conditional so an emptyannotations:key isn't emitted when the field is unset.Also dropped: upstream's
.gitignoreentry forhacking/anddev/awx-cr/awx-db-configuration.cr.yml— this fork has nodev/directory.Verified rather than assumed: the ConfigMap mounts at
/opt/app-root/src/postgresql-cfg, which is the sclorg config include directory, and this fork's_postgres_imageisquay.io/sclorg/postgresql-15-c9s, so the path is right. The new template's../common/templates/labels/common.yaml.j2lookup is the same one the existingconfigmaps/config.yaml.j2uses.Not verified: I have no cluster to deploy this against, so it is untested beyond reading. The CRD parses.
The docs hunk lands in
docs/user-guide/database-configuration.md, which #17 also touches, so one of the two will need a rebase.ISSUE TYPE
COMPONENT NAME