From 3b20a2d3d6f0878e13b3ca72c89bc88f8a05cba0 Mon Sep 17 00:00:00 2001 From: Chris Sun Date: Fri, 10 Jan 2025 17:16:30 +0800 Subject: [PATCH] list observer by obcluster name (#722) --- internal/dashboard/business/oceanbase/obcluster_usage.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/dashboard/business/oceanbase/obcluster_usage.go b/internal/dashboard/business/oceanbase/obcluster_usage.go index f015f6b5b..be772ca40 100644 --- a/internal/dashboard/business/oceanbase/obcluster_usage.go +++ b/internal/dashboard/business/oceanbase/obcluster_usage.go @@ -37,7 +37,9 @@ func GetOBClusterUsages(ctx context.Context, nn *param.K8sObjectIdentity) (*resp } clt := client.GetClient() serverList := &v1alpha1.OBServerList{} - err = clients.ServerClient.List(ctx, nn.Namespace, serverList, metav1.ListOptions{}) + err = clients.ServerClient.List(ctx, nn.Namespace, serverList, metav1.ListOptions{ + LabelSelector: oceanbaseconst.LabelRefOBCluster + "=" + obcluster.Name, + }) if err != nil { return nil, httpErr.NewInternal(err.Error()) }