Commit ead8a76
authored
[DPE-10615] Migrate TLS to the single-kernel library (VM) (#1816)
* feat(tls): migrate TLS to the single-kernel library
Consume the single-kernel library's operator-certificate TLS handler
(events.tls.TLS) and TLSManager instead of the charm-side src/relations/tls.py,
stacked on the DPE-10062 Patroni/cluster port (#1788). The TLS events handler
owns the two certificate requirers and is constructor-injected into TLSManager,
whose live-fetch getters read cert/key from them. A charm-side reload bridge
(_reload_tls_after_push) reloads PostgreSQL after the lib handler stores+pushes
certs; it also fires on relation_broken so detaching the TLS operator re-renders
Patroni with TLS disabled.
Removes src/relations/tls.py and push_tls_files_to_workload (now owned by the
lib), routes internal-cert regeneration through _regenerate_internal_cert,
redirects the operator-cert getters to tls_manager, and pins the library to the
TLS stack tip via archive URL (16.3.2 is not yet released).
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* build(deps): bump single-kernel lib to the 16.3.3 stack tip
The TLS lib stack was rebased onto current 16/edge and re-bumped to
16.3.3 because 16/edge had meanwhile shipped its own 16.3.2, and the
rebase dropped the dead workload parameter from the TLS events handler
constructor, so the pin and the construction call move together.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* test(tls): assert relation_broken bridge ordering and exception defer
The relation_broken bridge registrations reference only self.on[...], so
an __init__ reorder above the lib handler's construction would silently
run the reload before the lib clears state and pushes files; the prior
test asserted membership without order. The bridge's except-and-defer
branch also had no coverage, so a refactor could drop the broad guard
without failing CI.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* build(deps): bump single-kernel pin to a1d2178 (cleaned lib)
Re-pin the unreleased single-kernel library from 5a9fa05 to a1d2178,
the rebased TLS-stack tip. a1d2178 includes the operator-cert manager/
events handler (the migration payload) plus the docstring/comment cleanup
that dropped stale operator-repo file-path references and #168/V3-V4 idiom
mentions from the lib. The 5a9fa05→a1d2178 diff is docstring/comment-only,
so no charm-side code changes are required.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* test(tls): drop observer-wiring tests from test_tls.py
Remove _platform_machine, _observers_for, and the three
reload-bridge observer-ordering tests that exercised charm-side
__init__ wiring now that the bridge itself is transitional and
scheduled to leave the charm when update_config ports to the lib.
_platform_machine was redundant: refresh_versions.toml keys both
x86_64 and aarch64, so the platform.machine() snap-revision lookup
succeeds natively on either arch without the monkeypatch (proven by
the suite passing on aarch64 after removal). Its harness dependency
and the now-unused TLS_CLIENT/TLS_PEER_RELATION imports go with it.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* build(deps): pin single-kernel lib to published 16.3.3
The TLS flip branch pinned postgresql-charms-single-kernel to a GitHub
archive URL (commit a1d2178) to test unreleased lib changes. 16.3.3 is
now published to PyPI carrying the same TLS state + manager/events
content, so restore the published-version pin form and regenerate
poetry.lock against the PyPI wheel/tarball.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* build(deps): pin single-kernel to PITR-fix archive on TLS branch
Point the lib dependency at the #179 fix archive (16.3.4 = 16.3.3 plus the
get_member_status RetryError guard) so this TLS-migration branch's CI proves
the PITR restore integration test stops failing before 16.3.4 is published.
The archive carries the same 4-arg TLSManager this branch already targets, so
no charm code changes are needed. Temporary: revert to the published version
once the lib release lands.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* build(deps): pin single-kernel lib to published 16.3.4
Move the TLS branch off the pre-release GitHub-archive commit pin to the
released PyPI 16.3.4 package. 16.3.4 ships the DPE-10663 fix for
Patroni get_member_status when the cluster is unreachable — the path
test_tls_enabled exercises when patroni is stopped mid-test — which the
archive commit pin was capturing ahead of release; the published release
now supersedes that stopgap.
Drop the redundant `vm` extra: the charm already declares charmlibs-snap,
charmlibs-systemd, psutil, and pysyncobj as direct dependencies, so the
lib extra only re-declared them.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
* build(deps): restore the vm extra on the single-kernel pin
Keep both extras on the lib pin to match the branch's original pin
shape. The vm extra carries the lower-bound constraints for the
VM-only deps (charmlibs-snap, charmlibs-systemd, psutil, pysyncobj)
that the lib expects, which the charm also declares directly.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
---------
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>1 parent d4c9209 commit ead8a76
8 files changed
Lines changed: 221 additions & 501 deletions
File tree
- src
- relations
- tests/unit
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 112 | + | |
| 113 | + | |
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
| |||
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
| 122 | + | |
124 | 123 | | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
129 | | - | |
| 128 | + | |
130 | 129 | | |
131 | 130 | | |
132 | 131 | | |
| |||
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | | - | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
| |||
167 | 165 | | |
168 | 166 | | |
169 | 167 | | |
170 | | - | |
171 | 168 | | |
172 | 169 | | |
173 | 170 | | |
| |||
379 | 376 | | |
380 | 377 | | |
381 | 378 | | |
382 | | - | |
| 379 | + | |
383 | 380 | | |
384 | 381 | | |
385 | 382 | | |
386 | | - | |
387 | 383 | | |
388 | 384 | | |
389 | 385 | | |
| |||
421 | 417 | | |
422 | 418 | | |
423 | 419 | | |
424 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
425 | 445 | | |
426 | 446 | | |
427 | 447 | | |
| |||
498 | 518 | | |
499 | 519 | | |
500 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
501 | 564 | | |
502 | 565 | | |
503 | 566 | | |
| |||
509 | 572 | | |
510 | 573 | | |
511 | 574 | | |
512 | | - | |
| 575 | + | |
513 | 576 | | |
514 | 577 | | |
515 | 578 | | |
| |||
1548 | 1611 | | |
1549 | 1612 | | |
1550 | 1613 | | |
1551 | | - | |
| 1614 | + | |
1552 | 1615 | | |
1553 | 1616 | | |
1554 | 1617 | | |
| |||
1759 | 1822 | | |
1760 | 1823 | | |
1761 | 1824 | | |
1762 | | - | |
| 1825 | + | |
1763 | 1826 | | |
1764 | 1827 | | |
1765 | 1828 | | |
| |||
1946 | 2009 | | |
1947 | 2010 | | |
1948 | 2011 | | |
1949 | | - | |
| 2012 | + | |
1950 | 2013 | | |
1951 | 2014 | | |
1952 | 2015 | | |
| |||
2497 | 2560 | | |
2498 | 2561 | | |
2499 | 2562 | | |
2500 | | - | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
2501 | 2566 | | |
2502 | 2567 | | |
2503 | | - | |
| 2568 | + | |
2504 | 2569 | | |
2505 | 2570 | | |
2506 | 2571 | | |
| |||
2582 | 2647 | | |
2583 | 2648 | | |
2584 | 2649 | | |
2585 | | - | |
2586 | | - | |
2587 | | - | |
2588 | | - | |
2589 | | - | |
2590 | | - | |
2591 | | - | |
2592 | | - | |
2593 | | - | |
2594 | | - | |
2595 | | - | |
2596 | | - | |
2597 | | - | |
2598 | | - | |
2599 | | - | |
2600 | | - | |
2601 | | - | |
2602 | | - | |
2603 | | - | |
2604 | | - | |
2605 | | - | |
2606 | | - | |
2607 | | - | |
2608 | | - | |
2609 | | - | |
2610 | | - | |
2611 | | - | |
2612 | | - | |
2613 | | - | |
2614 | | - | |
2615 | | - | |
2616 | 2650 | | |
2617 | 2651 | | |
2618 | 2652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
488 | | - | |
| 488 | + | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| |||
0 commit comments