Skip to content

Commit

Permalink
fix(es): ES集群地域信息维护 #4410
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyao963 authored and zhangzhw8 committed Jun 14, 2024
1 parent e0647e4 commit d358986
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dbm-ui/backend/db_meta/api/cluster/es/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def create(
storages: Optional[List] = None,
creator: str = "",
major_version: str = "",
region: str = "",
):
"""
注册 ES 集群
Expand All @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions dbm-ui/backend/flow/engine/bamboo/scene/es/es_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/flow/utils/es/es_db_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit d358986

Please sign in to comment.