refactor(watcher): use the watcher module from the single kernel library - #1943
Draft
marceloneppel wants to merge 1 commit into
Draft
refactor(watcher): use the watcher module from the single kernel library#1943marceloneppel wants to merge 1 commit into
marceloneppel wants to merge 1 commit into
Conversation
Adopts the library's substrate-neutral WatcherEventsHandler (postgresql-single-kernel-library #274-#276, pinned at 3d9478488e1f739649282c86e1218dd92fc96eca = 16.3.14): the stereo-mode watcher-offer relation, the Raft secret handout, the watcher PostgreSQL user lifecycle and the per-unit address publishing move to the library; the charm drops src/relations/watcher.py and its unit tests. The charm keeps the substrate-tangled pieces the handler consumes as bridges: cleanup_raft_cluster / remove_raft_member delegate to the residual RAFT Patroni, is_primary_cluster to the async-replication module, and update_config no longer threads watcher_raft_address — the library's config manager sources it from the injected handler. The tests for the module now live in the library (test_watcher.py), where they run against both substrate harnesses. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.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.
Issue
Follows the watcher module migration into the single kernel library (postgresql-single-kernel-library #274, #275, #276).
Solution
The charm drops its own watcher module in favour of the library's substrate-neutral
WatcherEventsHandler, ported from the VM charm'ssrc/relations/watcher.py. The stereo-modewatcher-offerrelation, the Raft secret handout, the watcher PostgreSQL user lifecycle and the per-unit address publishing are owned by the library now.The charm keeps the substrate-tangled pieces the handler consumes as bridges, until their own migration phases (RAFT manager, async-replication manager, charm_refresh):
cleanup_raft_cluster/remove_raft_memberdelegate to the residual RAFTPatroni;is_primary_clusterdelegates to the async-replication module;update_configno longer threadswatcher_raft_address— the library's config manager sources the Raft address from the injected handler.The unit tests for the module live in the library (
tests/unit/test_watcher.py), where they run against the substrate-parameterised harness; the charm'stests/unit/test_charm.pywatcher patches carry over unchanged.The library is pinned at commit 3d9478488e1f739649282c86e1218dd92fc96eca (= 16.3.14) via archive URL, so CI exercises exactly the draft library stack.