Fix restore postgres password mismatch on fresh instances#183
Open
ssimpson89 wants to merge 3 commits intoctrliq:mainfrom
Open
Fix restore postgres password mismatch on fresh instances#183ssimpson89 wants to merge 3 commits intoctrliq:mainfrom
ssimpson89 wants to merge 3 commits intoctrliq:mainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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.ymlfrom 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>
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.
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.