[DPE-10841] feat(database): publish client endpoints from the manager (3/7) - #218
Merged
Merged
Conversation
Completes the client-relation manager with the read/write and read-only endpoint publishing the config flow refreshes today through a charm bridge. VM derives the addresses from the online Patroni members, filtering out-of-sync ones; K8s reads the primary and replicas Services, so CharmState grows the replicas endpoint to match the primary one it already exposed. The read-only connection URI is now built from the read-only hosts rather than the read-only endpoints. K8s interpolated a value that already carried the port and published postgresql://user:pw@host:5432:5432/db, which no client can dial; VM's port-less form is the one both substrates now use. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
2 tasks
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.
Issue
Third slice of the
postgresql_provider.pymigration. The client relation's read/write and read-only endpoints are still published by the charm, which is whyConfigManagercurrently calls back through arefresh_endpointsbridge.Solution
Completes
managers/database.pywithupdate_endpoints(), plusCharmState.replicas_endpointalongside the primary endpoint it already exposed.The two substrates compute the addresses differently and both forms are kept:
nosync, takes the leader'sdatabase-addressas the read/write endpoint and the replicas' as the read-only ones, falling back to the primary when there are no replicas.<app>-primaryand<app>-replicasServices.One behaviour change. The read-only connection URI is now built from the read-only hosts rather than the read-only endpoints. On K8s,
ro_endpointsalready carried:5432, and interpolating it into the URI template published a second one. Reproduced onpostgresql-k8s16/edge rev 943 againstdata-integrator:No client can dial that host. VM built the same URI from the port-less
ro_hostsand was correct; both substrates now use that form.Unit tests are in PR 6, including a case that asserts a single port in the read-only URI.
Stacked on 2/7. Next: 4/7.
Checklist