From 73c18751aa5b36488c1d18e2f5e7c2223b40f689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=AF=E8=88=AA?= <101104760+ZhangSetSail@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:22:29 +0800 Subject: [PATCH] fix: sort node role (#2124) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张启航 <101104760+ZhangSetSail@users.noreply.github.com> --- api/handler/nodes.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/handler/nodes.go b/api/handler/nodes.go index acd656823..982af35cd 100644 --- a/api/handler/nodes.go +++ b/api/handler/nodes.go @@ -22,6 +22,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "runtime" + "sort" "strings" "github.com/goodrain/rainbond/api/model" @@ -264,8 +265,8 @@ func (n *nodesHandle) HandleNodeInfo(node v1.Node) (nodeinfo model.NodeInfo, err } roles = append(roles, role) } - continue } + sort.Strings(roles) logrus.Infof("show node role %v", roles) // req resource from Prometheus var query string