Skip to content

[DPE-10843] refactor: adopt single-kernel update_config - #1849

Merged
marceloneppel merged 2 commits into
16/edgefrom
skl-01-adopt-update-config
Aug 19, 2026
Merged

[DPE-10843] refactor: adopt single-kernel update_config#1849
marceloneppel merged 2 commits into
16/edgefrom
skl-01-adopt-update-config

Conversation

@marceloneppel

@marceloneppel marceloneppel commented Jul 11, 2026

Copy link
Copy Markdown
Member

Issue

The VM charm carried its own copy of the update_config subsystem (PostgreSQL parameter building → patroni.yml render → Patroni REST config patch → reload/restart decision → config-hash persistence), and its TLS reload bridge observed certificate_available directly. Both now live in the postgresql-charms-single-kernel library; this PR makes the charm consume them.

Solution

  • update_config: delegate to the library's ConfigManager (constructor-injected with tls_manager, patroni_manager, and the three charm-owned bridges request_restart/refresh_endpoints/restart_services); remove the charm's own copy of the subsystem and templates/patroni.yml.j2 (the library owns them).
  • TLS reload: observe the library's new tls_files_pushed event instead of the four certificate_available/relation_broken observers, and drop the two guards (internal-ca present, client_tls_files_on_disk()) the bridge duplicated — the event fires only after a successful push, so a deferred push no longer triggers a reload against files that were never written.
  • Resource introspection: wire the VM workload as the state's resource_provider, so the parameter sizing in update_config reads this unit's cpu/memory through CharmState.available_resources rather than the workload directly. The library relocated that lookup behind a per-substrate provider.
  • Pin the library at the published 16.3.5 release, with the postgresql and vm extras.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

@github-actions github-actions Bot added the Libraries: Out of sync The charm libs used are out-of-sync label Jul 11, 2026
Base automatically changed from flip/tls-lib to 16/edge July 16, 2026 11:48
@marceloneppel
marceloneppel force-pushed the skl-01-adopt-update-config branch from 2abf30d to 8d2f8c8 Compare July 20, 2026 19:13
@marceloneppel marceloneppel changed the title refactor(config): adopt the single-kernel update_config subsystem refactor: adopt single-kernel update_config and tls_files_pushed reload Jul 20, 2026
@marceloneppel marceloneppel added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Jul 20, 2026
@marceloneppel
marceloneppel force-pushed the skl-01-adopt-update-config branch 3 times, most recently from 130279e to 71f6116 Compare July 23, 2026 18:18
@marceloneppel marceloneppel changed the title refactor: adopt single-kernel update_config and tls_files_pushed reload refactor: adopt single-kernel update_config, tls_files_pushed reload, and resource introspection Aug 11, 2026
@marceloneppel marceloneppel changed the title refactor: adopt single-kernel update_config, tls_files_pushed reload, and resource introspection refactor: adopt single-kernel update_config Aug 13, 2026
@marceloneppel marceloneppel changed the title refactor: adopt single-kernel update_config [DPE-10843] refactor: adopt single-kernel update_config Aug 13, 2026
@marceloneppel
marceloneppel force-pushed the skl-01-adopt-update-config branch from aece4e4 to 43dac9e Compare August 18, 2026 19:39
Migrate the charm's update_config, resource introspection, and TLS
reload onto the single-kernel library, now published as 16.3.5: the
charm delegates Patroni config re-render to the lib's ConfigManager,
reads available resources through the lib, and observes the lib's
tls_files_pushed event for the TLS reload bridge. Drops the charm's
now-redundant patroni.yml.j2 template and update_config tests.

The pin moves from the pre-merge archive-URL SHA to the published 16.3.5
release (extras: postgresql, vm) -- same lib tree, now sourced from
PyPI; the adoption code is unchanged.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@marceloneppel
marceloneppel force-pushed the skl-01-adopt-update-config branch from 43dac9e to 429abf3 Compare August 18, 2026 21:20
@marceloneppel
marceloneppel marked this pull request as ready for review August 19, 2026 04:14
@marceloneppel
marceloneppel requested a review from a team as a code owner August 19, 2026 04:14
@marceloneppel
marceloneppel requested review from carlcsaposs-canonical, dragomirp, juju-charm-bot and taurus-forever and removed request for a team August 19, 2026 04:14
dragomirp
dragomirp previously approved these changes Aug 19, 2026
taurus-forever
taurus-forever previously approved these changes Aug 19, 2026
…e-config

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>

# Conflicts:
#	poetry.lock
@marceloneppel
marceloneppel merged commit 946c478 into 16/edge Aug 19, 2026
896 of 940 checks passed
@marceloneppel
marceloneppel deleted the skl-01-adopt-update-config branch August 19, 2026 21:07
marceloneppel added a commit that referenced this pull request Aug 21, 2026
Merge origin/16/edge (28 commits) into the branch: dependency updates,
docs removal, and the single-kernel lib 16.3.5 update_config adoption
(#1849), which moved the worker-config and _api_update_config logic
into the library.

That refactor removed the charm-side _api_update_config that carried
the DPE-10203 stale-standby fix, so the fix is re-applied at the new
seam: update_config now clears the DCS standby_cluster when this
cluster is the primary. The dead-DC recovery behavior survives the
sync, with the regression test adapted to the new call path.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
marceloneppel added a commit that referenced this pull request Aug 21, 2026
Merge the fixes branch after its sync with 16/edge (single-kernel lib
16.3.5 update_config adoption #1849 among 28 commits), so the stacked
PR's diff and CI run against the current base.

The charm-side sync moved the DPE-10203 stale-standby fix to the new
update_config seam; this merge carries that over. The stacked branch's
own planned-units regression tests are kept at the tail of the test
file, replacing the worker-config tests the upstream refactor deleted.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Libraries: Out of sync The charm libs used are out-of-sync not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants