refactor(tls): reload on tls_files_pushed instead of certificate_available#1663
Closed
marceloneppel wants to merge 2 commits into
Closed
refactor(tls): reload on tls_files_pushed instead of certificate_available#1663marceloneppel wants to merge 2 commits into
marceloneppel wants to merge 2 commits into
Conversation
The single-kernel PostgreSQL library now owns the full update_config subsystem (parameter building, Patroni API patching, K8s slot sync, restart handling, and hash persistence), matching the already-adopted VM charm. Duplicating this logic in both places would let the two substrates drift out of sync on every future config change, so the charm delegates to the lib's ConfigManager instead of keeping its own copy. The charm now constructs a 7-arg ConfigManager wired with 3 bridge callbacks (request_restart, refresh_endpoints, restart_services) so the lib can trigger K8s-specific pebble/metrics side effects without depending on charm internals directly. update_config becomes a thin wrapper that also catches DeployedWithoutTrustError, since the lib's K8s workload now raises this on a 403 instead of a raw ApiError. 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. This also removes the ops observer-order dependency the wiring tests asserted. Re-pin the lib to the commit that adds the event. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
marceloneppel
force-pushed
the
skl-01-adopt-update-config-k8s
branch
from
July 20, 2026 19:13
76be2e2 to
65d097d
Compare
Member
Author
|
Folded into #1647: the TLS |
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
The lib TLS handler pushes cert files to the workload on
certificate_available, and this charm reloads PostgreSQL (after refreshing the K8s trust store + charm-local CA bundle) in a separate observer of the same event.deferis per-observer, so a push that defers (e.g. a Pebble write fails during a cert renewal) while the reload observer completes leaves the retried push writing the new cert with nothing reloading. The bridge also duplicated the handler's two readiness guards, and its wiring tests asserted an ops observer-order dependency. Raised in review on the TLS migration (#1618).Solution
The lib now emits a
tls_files_pushedevent after a successful push (canonical/postgresql-single-kernel-library#189). Observe that single event instead of the fourcertificate_available/relation_brokenobservers, and drop the two guards (internal-capresent,client_tls_files_on_disk()): the event fires only once the files are on disk, so a deferred push no longer triggers a reload against files that were never written, and the observer-order dependency is gone. The K8s-specific trust-store + CA-bundle sync still runs before the reload. Re-pin the lib to the commit that adds the event.Stacked on the update_config adoption.
Checklist