feat(tls): emit tls_files_pushed after a successful cert push (6/6)#189
Draft
marceloneppel wants to merge 2 commits into
Draft
feat(tls): emit tls_files_pushed after a successful cert push (6/6)#189marceloneppel wants to merge 2 commits into
marceloneppel wants to merge 2 commits into
Conversation
marceloneppel
force-pushed
the
skl-01-update-config-tests
branch
from
July 20, 2026 19:04
808b479 to
373a525
Compare
marceloneppel
force-pushed
the
tls-files-pushed
branch
from
July 20, 2026 19:04
7306394 to
c5861ea
Compare
marceloneppel
force-pushed
the
skl-01-update-config-tests
branch
from
July 20, 2026 20:25
373a525 to
558c61f
Compare
marceloneppel
force-pushed
the
tls-files-pushed
branch
from
July 20, 2026 20:25
c5861ea to
d91d183
Compare
marceloneppel
force-pushed
the
skl-01-update-config-tests
branch
from
July 21, 2026 17:47
558c61f to
ba946a4
Compare
marceloneppel
force-pushed
the
tls-files-pushed
branch
from
July 21, 2026 17:47
d91d183 to
cc243c6
Compare
The TLS handler pushes cert files to the workload on certificate_available, and the charm reloads PostgreSQL in a separate observer of the same event. Because defer is per-observer, a push that defers (e.g. a Pebble write fails mid cert renewal) while the charm's reload observer completes leaves the retried push writing the new cert with nothing reloading. Emit a tls_files_pushed event only after push_tls_files() succeeds; a deferred push returns without emitting. The charm's reload bridge observes this instead of certificate_available, so the reload runs only once the files are on disk and a deferred push retries together with its reload. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
The update_config + tls_files_pushed stack branched at 16.3.3; 16/edge has since released 16.3.4. Set the version to the next patch so the library is release-ready as soon as this stack lands on 16/edge. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
marceloneppel
force-pushed
the
skl-01-update-config-tests
branch
from
July 23, 2026 17:45
ba946a4 to
af641bb
Compare
marceloneppel
force-pushed
the
tls-files-pushed
branch
from
July 23, 2026 17:46
cc243c6 to
ff8e9d1
Compare
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 TLS handler pushes cert files to the workload on
certificate_available; the charm reloads PostgreSQL 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 charm's reload observer completes leaves the retried push writing the new cert with nothing reloading — the reload ran against the stale on-disk files and won't run again. Raised in review on the K8s TLS migration (canonical/postgresql-k8s-operator#1618).Solution
Add a
tls_files_pushedcustom event on theTLShandler, emitted only afterpush_tls_files()succeeds; either defer guard returns without emitting. The charm's reload bridge observes this instead ofcertificate_available, so the reload fires only once the files are on disk, and a deferred push retries together with its reload. This also lets the charms drop the two guards (internal-capresent,client_tls_files_on_disk()) they duplicate from this handler.Stacked on the update_config lib stack; the two charm rewires follow and pin this commit.
Checklist