Skip to content

refactor: adopt single-kernel update_config and tls_files_pushed reload#1849

Draft
marceloneppel wants to merge 3 commits into
16/edgefrom
skl-01-adopt-update-config
Draft

refactor: adopt single-kernel update_config and tls_files_pushed reload#1849
marceloneppel wants to merge 3 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.
  • Pin the library at the archive of the combined update_config + tls_files_pushed stack (v16.3.5).

Targets 16/edge directly (rebased on the library's merged base). Draft until the library releases and the pin flips to version="16.3.5".

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 from 8d2f8c8 to 7a2e2e0 Compare July 20, 2026 20:35
Delegate update_config to the library's ConfigManager (constructor-injected with tls_manager, patroni_manager, and the three charm-owned bridges request_restart/refresh_endpoints/restart_services), and remove the charm's own copy of the subsystem plus templates/patroni.yml.j2 (the library owns them). Pin the library at the archive of the update_config + tls_files_pushed stack (v16.3.5).

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

The lib TLS handler now emits tls_files_pushed after a successful cert push. Observe that single event instead of certificate_available/relation_broken on both requirers, and drop the two guards (internal-ca present, cert files on disk) the bridge duplicated from the handler: the event fires only once the push has landed, so a deferred push no longer lets the bridge reload against stale files. Re-pin the lib to the commit that adds the event.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@marceloneppel
marceloneppel force-pushed the skl-01-adopt-update-config branch from 7a2e2e0 to 5fe60ed Compare July 21, 2026 20:27
The lib moved K8s resource introspection off the workload onto K8sManager and now sources this unit's (cpu, memory) through CharmState.available_resources, backed by a per-substrate provider (review response on the parameter-building PR). Re-pin the lib to the rebased stack top and wire the VM workload as the state's resource_provider so update_config's config sizing keeps working.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@marceloneppel
marceloneppel force-pushed the skl-01-adopt-update-config branch from 130279e to 71f6116 Compare July 23, 2026 18:18
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.

1 participant