Skip to content

Commit

Permalink
feat(backend): es 拓扑适配多种组织方式 TencentBlueKing#8170
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Nov 26, 2024
1 parent f035a88 commit 77673c8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions dbm-ui/backend/db_meta/api/cluster/es/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ def scan_cluster(cluster: Cluster) -> Graphic:
)

# 获得Master节点组,冷节点组,热节点组
_dummy, master_group = graph.add_instance_nodes(
hot_insts, master_group = graph.add_instance_nodes(
cluster=cluster, roles=InstanceRole.ES_MASTER, group_name=_("Master 节点")
)
_dummy, hot_node_group = graph.add_instance_nodes(
master_insts, hot_node_group = graph.add_instance_nodes(
cluster=cluster, roles=InstanceRole.ES_DATANODE_HOT, group_name=_("热节点")
)
_dummy, cold_node_group = graph.add_instance_nodes(
cold_insts, cold_node_group = graph.add_instance_nodes(
cluster=cluster, roles=InstanceRole.ES_DATANODE_COLD, group_name=_("冷节点")
)
entry = cluster.clusterentry_set.first()

if client_group:
hub_group = client_group
# 获得访问入口节点组
entry = client_insts.first().bind_entry.first()
_dummy, entry_group = graph.add_node(entry)

# 访问入口 ---> Client节点,关系为:访问
graph.add_line(source=entry_group, target=client_group, label=LineLabel.Access)
# Client节点 ---> Master/冷/热节点,关系为:访问
Expand All @@ -51,5 +51,14 @@ def scan_cluster(cluster: Cluster) -> Graphic:
graph.add_line(source=client_group, target=hot_node_group, label=LineLabel.Access)
if cold_node_group:
graph.add_line(source=client_group, target=cold_node_group, label=LineLabel.Access)
elif hot_node_group:
_dummy, entry_group = graph.add_node(entry)
hub_group = hot_node_group
graph.add_line(source=entry_group, target=hot_node_group, label=LineLabel.Access)
graph.add_line(source=hot_node_group, target=master_group, label=LineLabel.Access)
else:
hub_group = master_group
if cold_node_group:
graph.add_line(source=hub_group, target=cold_node_group, label=LineLabel.Access)

return graph

0 comments on commit 77673c8

Please sign in to comment.