From d3589869caafd655bf412323bc29b4099c05988a Mon Sep 17 00:00:00 2001 From: santu Date: Thu, 13 Jun 2024 17:51:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(es):=20ES=E9=9B=86=E7=BE=A4=E5=9C=B0?= =?UTF-8?q?=E5=9F=9F=E4=BF=A1=E6=81=AF=E7=BB=B4=E6=8A=A4=20#4410?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/backend/db_meta/api/cluster/es/create.py | 2 ++ dbm-ui/backend/flow/engine/bamboo/scene/es/es_flow.py | 3 +++ dbm-ui/backend/flow/utils/es/es_db_meta.py | 1 + 3 files changed, 6 insertions(+) diff --git a/dbm-ui/backend/db_meta/api/cluster/es/create.py b/dbm-ui/backend/db_meta/api/cluster/es/create.py index a57dc4201b..58a922567d 100644 --- a/dbm-ui/backend/db_meta/api/cluster/es/create.py +++ b/dbm-ui/backend/db_meta/api/cluster/es/create.py @@ -33,6 +33,7 @@ def create( storages: Optional[List] = None, creator: str = "", major_version: str = "", + region: str = "", ): """ 注册 ES 集群 @@ -55,6 +56,7 @@ def create( status=ClusterStatus.NORMAL.value, major_version=major_version, bk_cloud_id=bk_cloud_id, + region=region, ) cluster_entry = ClusterEntry.objects.create( diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/es/es_flow.py b/dbm-ui/backend/flow/engine/bamboo/scene/es/es_flow.py index 350a477928..3512dd1d5e 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/es/es_flow.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/es/es_flow.py @@ -51,6 +51,7 @@ def __init__(self, root_id: str, data: Optional[Dict]): self.domain = data.get("domain") self.http_port = data.get("http_port") self.bk_cloud_id = data.get("bk_cloud_id") + self.city_code = data.get("city_code") # 从dbconfig获取配置信息 dbconfig = DBConfigApi.query_conf_item( @@ -71,6 +72,7 @@ def __init__(self, root_id: str, data: Optional[Dict]): self.cluster_id = data.get("cluster_id") cluster = Cluster.objects.get(id=self.cluster_id) self.cluster_name = cluster.name + self.city_code = cluster.region masters = StorageInstance.objects.filter(cluster=cluster, instance_role=InstanceRole.ES_MASTER) if not masters: logger.info("found 0 master node") @@ -132,6 +134,7 @@ def get_flow_base_data(self) -> dict: "domain": self.domain, "es_config": self.es_config, "resource_spec": self.resource_spec, + "city_code": self.city_code, } return flow_data diff --git a/dbm-ui/backend/flow/utils/es/es_db_meta.py b/dbm-ui/backend/flow/utils/es/es_db_meta.py index f8f6d12794..4e412dbf7f 100644 --- a/dbm-ui/backend/flow/utils/es/es_db_meta.py +++ b/dbm-ui/backend/flow/utils/es/es_db_meta.py @@ -115,6 +115,7 @@ def es_apply(self) -> bool: "storages": storage_instances, "creator": self.ticket_data["created_by"], "major_version": self.ticket_data["db_version"], + "region": self.ticket_data["city_code"], } with atomic():