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

[DPE-1454] Update database ownership #227

Merged
merged 3 commits into from
May 17, 2024
Merged

Conversation

dragomirp
Copy link
Contributor

@dragomirp dragomirp commented May 8, 2024

Issue

Cannot drop db objects when rerelating to pgbouncer

Solution

  • Pass relations to create_database
  • Update charm libs

Port of canonical/pgbouncer-k8s-operator#287

@dragomirp dragomirp marked this pull request as ready for review May 8, 2024 13:35
Comment on lines 200 to 202
delete_db = database not in dbs.values()
if database and delete_db:
self.charm.backend.remove_auth_function(dbs=[database])
Copy link
Member

Choose a reason for hiding this comment

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

Similar to the K8s PR, it seems that the auth_function is not being removed correctly.

juju deploy postgresql --channel 14/edge
juju deploy ./pgbouncer_ubuntu-22.04-amd64.charm
juju deploy data-integrator app1

juju relate pgbouncer postgresql
juju config app1 database-name=test
juju relate app1 pgbouncer

juju run postgresql/leader get-password
psql "host={postgresql-unit-ip} user=operator dbname=test password={password}”
# Run SELECT specific_schema FROM information_schema.routines WHERE routine_name='get_auth'; which outputs pgbouncer_auth_relation_7.

juju run app1/leader get-credentials
psql "host={ip-from-get-credentials} user={user-from-get-credentials} dbname={database-name-from-get-credentials} password={password-from-get-credentials}”
# The connection works.

juju remove-relation app1 pgbouncer
psql "host={postgresql-unit-ip} user=operator dbname=test password={password}”
# Run SELECT specific_schema FROM information_schema.routines WHERE routine_name='get_auth'; which still outputs pgbouncer_auth_relation_7.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unfortunately more complicated case than k8s, since the cleanup hooks are unreliable due to subordination. There's DPE-3948 to try to make things more consistent.

@dragomirp dragomirp requested a review from marceloneppel May 10, 2024 13:55
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

Nice!

@dragomirp dragomirp merged commit 216a7ca into main May 17, 2024
36 checks passed
@dragomirp dragomirp deleted the dpe-1454-rerelation-drop branch May 17, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants