-
Notifications
You must be signed in to change notification settings - Fork 27
[WIP] Stereo mode poc #1401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 16/edge
Are you sure you want to change the base?
[WIP] Stereo mode poc #1401
Conversation
Add a lightweight witness/voter charm that participates in Raft consensus to provide quorum in 2-node PostgreSQL clusters without storing any PostgreSQL data. Key components: - Watcher charm with Raft controller integration - Health checking for PostgreSQL endpoints - Relation interface (postgresql_watcher) for PostgreSQL operator - Topology and health check actions Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
| content = secret.get_content(refresh=True) | ||
| return content.get("raft-password") | ||
| except SecretNotFoundError: | ||
| logger.warning(f"Secret {secret_id} not found") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
| # Get the secret ID for sharing | ||
| try: | ||
| secret = self.charm.model.get_secret(label=WATCHER_SECRET_LABEL) | ||
| logger.info(f"Got secret for update: {secret}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
| secret = self.charm.model.get_secret(label=WATCHER_SECRET_LABEL) | ||
| logger.info(f"Got secret for update: {secret}") | ||
| secret_id = secret.id | ||
| logger.info(f"Initial secret_id: {secret_id}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
| # the ops library lazily loads the ID. We need the ID to share with the watcher. | ||
| logger.info("Applying secret ID workaround") | ||
| secret_info = secret.get_info() | ||
| logger.info(f"Secret info: {secret_info}, id={secret_info.id}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
| # Use the ID directly from get_info() - it already has the full URI | ||
| secret._id = secret_info.id | ||
| secret_id = secret.id | ||
| logger.info(f"Workaround secret_id: {secret_id}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
| "raft-partner-addrs": json.dumps(sorted(raft_partner_addrs)), | ||
| "raft-port": str(RAFT_PORT), | ||
| } | ||
| logger.info(f"Updating relation app data: {update_data}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
This expression logs
sensitive data (secret)
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (69.98%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## 16/edge #1401 +/- ##
===========================================
- Coverage 70.53% 69.98% -0.56%
===========================================
Files 16 17 +1
Lines 4297 4521 +224
Branches 691 720 +29
===========================================
+ Hits 3031 3164 +133
- Misses 1055 1133 +78
- Partials 211 224 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… pysyncobj Raft service Add standalone raft_service.py that implements KVStoreTTL-compatible Raft node managed as a systemd service, eliminating the dependency on the charmed-postgresql snap. Remove automatic health checks in favor of on-demand checks via action, since the watcher lacks PostgreSQL credentials. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
| return | ||
|
|
||
| # Write service file | ||
| Path(SERVICE_FILE).write_text(service_content) |
Check failure
Code scanning / CodeQL
Clear-text storage of sensitive information High
sensitive data (password)
This expression stores
sensitive data (password)
…tereo mode tests Replace cut_network_from_unit_without_ip_change with cut_network_from_unit in stereo mode integration tests. The iptables-based approach with REJECT was still causing timeouts; removing the interface entirely triggers faster TCP connection failures. Added use_ip_from_inside=True for check_writes since restored units get new IPs. Also adds spread task for stereo mode tests. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Issue
Solution
Add a lightweight witness/voter charm that participates in Raft consensus to provide quorum in 2-node PostgreSQL clusters without storing any PostgreSQL data.
Key components:
Checklist