Skip to content

Commit d89b0f8

Browse files
Bootstrap with force (#187)
Instead of relying on the existence of old router user to cleanup router from cluster metadata, force bootstrap so that the metadata does not need to be cleaned up. Fixes canonical/mysql-k8s-operator#345. The issue was that the router charm would delete the user & router metadata, but that only the user deletion would go through. Then, on the router charm's next hook, the bootstrap failed because the metadata was not cleaned up. Additional context: https://chat.canonical.com/canonical/pl/temrphcp3in5xqftkaxgowqtkr
1 parent 328194b commit d89b0f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/workload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,13 @@ def _router_id(self) -> str:
153153
return f"{socket.getfqdn()}::system"
154154

155155
def _cleanup_after_upgrade_or_potential_container_restart(self) -> None:
156-
"""Remove Router cluster metadata & user after upgrade or (potential) container restart.
156+
"""Remove Router user after upgrade or (potential) container restart.
157157
158158
(On Kubernetes, storage is not persisted on container restart—MySQL Router's config file is
159159
deleted. Therefore, MySQL Router needs to be bootstrapped again.)
160160
"""
161161
if user_info := self.shell.get_mysql_router_user_for_unit(self._charm.unit.name):
162162
logger.debug("Cleaning up after upgrade or container restart")
163-
self.shell.remove_router_from_cluster_metadata(user_info.router_id)
164163
self.shell.delete_user(user_info.username)
165164
logger.debug("Cleaned up after upgrade or container restart")
166165

@@ -176,6 +175,7 @@ def _get_bootstrap_command(self, password: str) -> typing.List[str]:
176175
+ ":"
177176
+ self._connection_info.port,
178177
"--strict",
178+
"--force",
179179
"--conf-set-option",
180180
"http_server.bind_address=127.0.0.1",
181181
"--conf-use-gr-notifications",

0 commit comments

Comments
 (0)