Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new postgres configuration secret when restoring a new instance #1733

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

rooftopcellist
Copy link
Member

@rooftopcellist rooftopcellist commented Feb 28, 2024

SUMMARY

Prior to this PR, when restoring:

  • User has a working deployment of AWX (awx-1)
  • User takes a backup
  • (User does not delete the original deployment)
  • User does a restore and ends up with a successful deployment of AWX by a new name (awx-2)
  • At this point though, the postgres-configuration-secret's host value has been changed from awx-1-postgres-13 --> awx-2-postgres-13. This results in the second deployment working, but the first deployment failing because it cannot reach the database.

The user has a working deployment from the restore at this point, so they can safely delete the initial deployment. It is a bug that the initial deployment is broken in the process, but the user is left with a working deployment.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
ADDITIONAL INFORMATION

Expected Behavior

The restore role attempts to inject the new host name for postgres into the existing secret.
This is the desired behavior if the name of the deployment is the same as the original deployment.

However, if the deployment_name is different (as we advise customers to do), the restore role should create a new secret with the new host name.

Verification Details

After this change, the host and secret name are set appropriately for the new deployment.

    "_pg_secret": {
        "data": {
            "database": "YXd4",
            "host": "bmV3LWF3eC1wb3N0Z3Jlcy0xMw==",
            "password": "SWxNYnNGR1JBeHJISm13clVYTW4zdHBOSExpTmpnUWI=",
            "port": "NTQzMg==",
            "type": "bWFuYWdlZA==",
            "username": "YXd4"
        },
        "name": "new-awx-postgres-configuration",
        "type": "Opaque"
    }
}
$ echo bmV3LWF3eC1wb3N0Z3Jlcy0xMw== | base64 -d
new-awx-postgres-13

After restoring, I am able to log in to my instance with a user from the old instance.

- This will avoid the operator changing the host value of the original
  deployments postgres_configuration_secret. As it was, restores broke
  the original deployment if it was still around before this change.

Signed-off-by: Christian M. Adams <[email protected]>
@rooftopcellist rooftopcellist merged commit ed6ac1a into ansible:devel Mar 11, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants