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():