-
Notifications
You must be signed in to change notification settings - Fork 20
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
[MISC] Suppress oversee users in standby clusters #507
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #507 +/- ##
==========================================
- Coverage 69.78% 69.72% -0.07%
==========================================
Files 11 11
Lines 2866 2870 +4
Branches 507 508 +1
==========================================
+ Hits 2000 2001 +1
- Misses 761 763 +2
- Partials 105 106 +1 ☔ View full report in Codecov by Sentry. |
187bb8e
to
8e9d9ee
Compare
911a659
to
ba1a260
Compare
fd8a477
to
9bafcf6
Compare
@@ -481,7 +482,7 @@ def is_primary_cluster(self) -> bool: | |||
return self.charm.app == self._get_primary_cluster() | |||
|
|||
def _on_async_relation_broken(self, _) -> None: | |||
if "departing" in self.charm._peers.data[self.charm.unit]: | |||
if not self.charm._peers or "departing" in self.charm._peers.data[self.charm.unit]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seen it fail in CI.
@pytest.mark.group(1) | ||
@markers.juju3 | ||
@pytest.mark.abort_on_fail | ||
async def test_get_data_integrator_credentials( | ||
ops_test: OpsTest, | ||
): | ||
unit = ops_test.model.applications[DATA_INTEGRATOR_APP_NAME].units[0] | ||
action = await unit.run_action(action_name="get-credentials") | ||
result = await action.wait() | ||
global data_integrator_credentials | ||
data_integrator_credentials = result.results | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just gets the credentials from data integrator.
@@ -193,6 +193,7 @@ def _configure_standby_cluster(self, event: RelationChangedEvent) -> bool: | |||
filename = f"{POSTGRESQL_DATA_PATH}-{str(datetime.now()).replace(' ', '-').replace(':', '-')}.tar.gz" | |||
subprocess.check_call(f"tar -zcf {filename} {POSTGRESQL_DATA_PATH}".split()) | |||
logger.warning("Please review the backup file %s and handle its removal", filename) | |||
self.charm.app_peer_data["suppress-oversee-users"] = "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set a flag when a cluster is made a standby
delete_user = "suppress-oversee-users" not in self.charm.app_peer_data | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the cluster is or was a standby, it will stop deleting relation users.
Currently there's no way to clear up the flag. Action to clear it up was moved to #509 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great! Thank you so much @dragomirp!
Stop deleting managed users without a relation. This is necessary to keep all credentials working when there is a switchover to standby cluster.