[DPE-10887] refactor(relations): adopt the single-kernel client relation - #1900
Open
marceloneppel wants to merge 2 commits into
Open
[DPE-10887] refactor(relations): adopt the single-kernel client relation#1900marceloneppel wants to merge 2 commits into
marceloneppel wants to merge 2 commits into
Conversation
marceloneppel
force-pushed
the
skl-02-adopt-database-provider
branch
from
August 17, 2026 19:47
6ddf535 to
f18998d
Compare
marceloneppel
force-pushed
the
skl-01-adopt-update-config
branch
2 times, most recently
from
August 18, 2026 21:20
43dac9e to
429abf3
Compare
marceloneppel
force-pushed
the
skl-02-adopt-database-provider
branch
from
August 18, 2026 21:34
b7e5521 to
2ee2329
Compare
This was referenced Aug 20, 2026
marceloneppel
force-pushed
the
skl-02-adopt-database-provider
branch
2 times, most recently
from
August 20, 2026 20:09
90720c8 to
065e94d
Compare
Move the database (client) relation provider into the single-kernel library: delete the charm's src/relations/postgresql_provider.py and its tests, and wire the provider events through the lib's DatabaseManager. The charm implements get_resource_provider so the lib's ConfigManager reads substrate resources via the resource_provider injection contract (lib #215) on the db-provider lib branch. Pin the lib at the rebased test/02-db-events tip (archive-URL SHA, since the db-provider stack is not yet published to PyPI), stacked on the skl-01 16.3.5 update_config adoption. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…relation The client-relation subsystem the branch adopts is now on 16/edge and published: the pin moves from the pre-release archive-URL stopgap (706cd21, the validated stack tip) to the released 16.3.6 from PyPI (extras: postgresql, vm) — the sdist is byte-identical to the validated tree, so the adoption code is unchanged apart from the wiring that follows the lib's review rework: the charm is now the composition root constructing DatabaseProvides and DatabaseManager, and the endpoint inputs (online Patroni members on VM, client TLS files) are gathered caller-side and threaded into update_endpoints, as the lib no longer holds peer-manager references. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
marceloneppel
force-pushed
the
skl-02-adopt-database-provider
branch
from
August 24, 2026 17:59
b63386f to
61af3a2
Compare
marceloneppel
marked this pull request as ready for review
August 24, 2026 19:54
marceloneppel
requested review from
carlcsaposs-canonical,
dragomirp,
juju-charm-bot,
oleksii-buhaiov and
taurus-forever
and removed request for
a team
August 24, 2026 19:54
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
src/relations/postgresql_provider.py(645 lines) is a near-copy of the K8s charm's version of the same file, and the library now owns the postgresql-client relation.Solution
Deletes the charm's provider and its tests, and constructs
single_kernel_postgresql.events.database.DatabaseEventsHandlerinstead. The remaining call sites move to the manager:oversee_users()now takes the PostgreSQL client,update_endpoints()takes an optional relation id rather than an event.The library pin is the published
16.3.6from PyPI. Following the library review, the charm is the composition root for the client-relation subsystem: it constructsDatabaseProvidesandDatabaseManageritself and passes the manager to the events handler.update_endpointstakes its inputs caller-side — the online Patroni members (gathered only on the leader, so non-leader units fire no extra REST calls) and the client TLS files.Two seams close with it:
refresh_endpointsis gone.ConfigManagerholds the database manager and refreshes endpoints itself.update_configno longer takes a user hash._collect_user_relationsdelegates to the manager, and the hash is derived from the same relation data the user-databases map comes from, sogenerate_user_hashhad nothing left to do.relations_user_databases_mapstays here — its computation diverges between the substrates and belongs to the core event-loop phase.Checklist