Skip to content

[DPE-10062] Port Patroni/cluster code to single kernel#172

Merged
dragomirp merged 34 commits into
16/edgefrom
dpe-10062-cluster2
Jul 2, 2026
Merged

[DPE-10062] Port Patroni/cluster code to single kernel#172
dragomirp merged 34 commits into
16/edgefrom
dpe-10062-cluster2

Conversation

@dragomirp

@dragomirp dragomirp commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@dragomirp dragomirp added the enhancement New feature or request label Jun 30, 2026

# Platform specific imports
with suppress(ImportError):
from charmlibs import snap

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't need to pull the dependency on k8s.

@dragomirp

Copy link
Copy Markdown
Contributor Author

Raft functions are still in the VM charm. Unit tests TBD.

Comment on lines +593 to +594
if candidate is not None:
candidate = candidate.replace("/", "-")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From k8s, needed to switch from unit to member name.

Comment on lines +631 to +637
for attempt in Retrying(stop=stop_after_delay(60), wait=wait_fixed(3), reraise=True):
with attempt:
new_primary = self.get_primary()
if (
candidate is not None and new_primary != candidate
) or new_primary == current_primary:
raise SwitchoverFailedError("primary was not switched correctly")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only on k8s, VM passes with it.

@dragomirp dragomirp force-pushed the dpe-10062-cluster2 branch from 9ad1e0a to de29c9d Compare June 30, 2026 23:33
@dragomirp dragomirp force-pushed the dpe-10062-cluster2 branch from de29c9d to 1bc58e4 Compare June 30, 2026 23:44

def update_synchronous_node_count(self) -> None:
"""Update synchronous_node_count to the minority of the planned cluster."""
for attempt in Retrying(stop=stop_after_delay(15), wait=wait_fixed(3)):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced from 1m. Can waste time when the charm is starting.

@dragomirp dragomirp marked this pull request as ready for review June 30, 2026 23:53
@dragomirp dragomirp requested a review from a team as a code owner June 30, 2026 23:53
@dragomirp dragomirp requested review from carlcsaposs-canonical, juju-charm-bot, marceloneppel and taurus-forever and removed request for a team June 30, 2026 23:53
marceloneppel added a commit that referenced this pull request Jul 1, 2026
The TLS stack (this PR, #164) lands after #172, which bumps the library to
16.3.1. Set 16.3.2 here so the released version is monotonic and does not
collide with #172's bump when both are merged.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@dragomirp dragomirp merged commit 3277dbf into 16/edge Jul 2, 2026
6 checks passed
marceloneppel added a commit that referenced this pull request Jul 2, 2026
The TLS stack had overridden the K8s patroni_conf path to /etc/patroni, a
vestige of an earlier TLS-hardening lineage. #172's Patroni port renders
patroni.yaml at patroni_conf, so it must stay the data storage root
(/var/lib/pg/data); the override made a consuming charm run
'patroni /etc/patroni/patroni.yaml' against a config rendered elsewhere. TLS
writes its .pem files to the separate 'tls' path (also the data dir) and does
not read patroni_conf, so this revert is TLS-safe.

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants