Skip to content

Fix restore postgres password mismatch on fresh instances#183

Open
ssimpson89 wants to merge 3 commits intoctrliq:mainfrom
ssimpson89:fix-restore-postgres-password
Open

Fix restore postgres password mismatch on fresh instances#183
ssimpson89 wants to merge 3 commits intoctrliq:mainfrom
ssimpson89:fix-restore-postgres-password

Conversation

@ssimpson89
Copy link
Copy Markdown
Contributor

When restoring a backup to a new Ascender instance, the operator generates a new random postgres password on install. The restore code then deletes the Postgres PVC and scales it back up, causing Postgres to re-initialize with the new password. The AWXRestore operator later tries to connect using the backup's password, which no longer matches.

Fix: patch the postgres-configuration K8s secret with the password from the local backup before scaling anything down. When Postgres re-initializes on the fresh PVC, it reads the password from the secret via POSTGRESQL_PASSWORD env var and uses the backup's password for initdb.

ssimpson89 and others added 2 commits March 23, 2026 11:16
When restoring a backup to a new Ascender instance, the operator
generates a new random postgres password on install. The restore
code then deletes the Postgres PVC and scales it back up, causing
Postgres to re-initialize with the new password. The AWXRestore
operator later tries to connect using the backup's password,
which no longer matches.

Fix: patch the postgres-configuration K8s secret with the password
from the local backup before scaling anything down. When Postgres
re-initializes on the fresh PVC, it reads the password from the
secret via POSTGRESQL_PASSWORD env var and uses the backup's
password for initdb.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The backup's secrets.yml has a top-level 'secrets' key containing
the individual secret entries, so the correct path is
backup_secrets.secrets.postgresConfigurationSecret, not
backup_secrets.postgresConfigurationSecret.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 23, 2026 18:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Ascender restore playbook to ensure Postgres re-initializes with the backup password on fresh instances by restoring the Postgres configuration Secret before scaling components down/up.

Changes:

  • Load secrets.yml from the local backup into Ansible variables.
  • Recreate/restore the Postgres configuration Kubernetes Secret from backup prior to scaling down Postgres and deleting its PVC.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants