Skip to content

Commit fbbc11b

Browse files
authored
feature: DPE-7534 use absolute fqdn and bigger ttl (#445)
## Issue See issues #443 and #444 Also, mysql-router configure `ttl=5` [seconds] whenever clusterset is configured, independently of the usage of `gr_notifications`. For comparison, without `gr_notifications` default is `ttl=0.5`, so this is a conservative change giving geographical concerns when having multiple clusters. Given we are using `gr_notifications`, it's safe to override to a greater value, since this is a fallback mechanism. ## Solution - use and propagate absolute fqdn (trailing dot) internally and to consumers - set `60s` as default metadata_cache refresh interval For test bundle (3 router, 3 server, 1 test-app), this changes (+ usage of absolute fqdn on server) took coredns requests from 2.18 kp/s to 0.270kp/s. ![requests_k8s](https://github.com/user-attachments/assets/db1d27bd-8b68-4a77-99b4-94fcb4446071) Fixes #443 #444
1 parent cff76ac commit fbbc11b

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/charm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def model_service_domain(self) -> str:
319319
def _host(self) -> str:
320320
"""K8s service hostname for MySQL Router"""
321321
# Example: mysql-router-k8s-service.my-model.svc.cluster.local
322-
return f"{self.service_name}.{self.model_service_domain}"
322+
return f"{self.service_name}.{self.model_service_domain}."
323323

324324
def _get_node_hosts(self) -> set[str]:
325325
"""Return the node ports of nodes where units of this app are scheduled."""

src/workload.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ def _get_bootstrap_command(
252252
"--conf-set-option",
253253
f"http_auth_backend:default_auth_backend.filename={self._container.rest_api_credentials_file.relative_to_container}",
254254
"--conf-use-gr-notifications",
255+
"--conf-set-option",
256+
"metadata_cache:bootstrap.ttl=5",
255257
# destination_status added to workaround MySQL Router bug
256258
# https://bugs.mysql.com/bug.php?id=118059
257259
# TODO: Remove once fixed on upstream

tests/integration/test_expose_external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async def confirm_cluster_ip_endpoints(ops_test: OpsTest) -> None:
6565
assert credentials["mysql"]["username"] is not None, "Username is empty"
6666
assert credentials["mysql"]["password"] is not None, "Password is empty"
6767

68-
endpoint_name = f"mysql-router-k8s-service.{ops_test.model.name}.svc.cluster.local"
68+
endpoint_name = f"mysql-router-k8s-service.{ops_test.model.name}.svc.cluster.local."
6969
assert credentials["mysql"]["endpoints"] == f"{endpoint_name}:6446", "Endpoint is unexpected"
7070
assert (
7171
credentials["mysql"]["read-only-endpoints"] == f"{endpoint_name}:6447"

0 commit comments

Comments
 (0)