From b34242e96958fbf85f9b24e86523d7c077650271 Mon Sep 17 00:00:00 2001 From: Rory Z <16801068+Rory-Z@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:22:07 +0800 Subject: [PATCH] fix: selector pod to request EMQX API Signed-off-by: Rory Z <16801068+Rory-Z@users.noreply.github.com> --- controllers/apps/v2beta1/emqx_controller.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/controllers/apps/v2beta1/emqx_controller.go b/controllers/apps/v2beta1/emqx_controller.go index 30a608a91..f540e62b1 100644 --- a/controllers/apps/v2beta1/emqx_controller.go +++ b/controllers/apps/v2beta1/emqx_controller.go @@ -171,19 +171,12 @@ func newRequester(k8sClient client.Client, instance *appsv2beta1.EMQX) (innerReq port = dashboardPort.TargetPort.String() } - labels := appsv2beta1.DefaultCoreLabels(instance) - if instance.Status.CoreNodesStatus.CurrentRevision != "" { - labels = appsv2beta1.CloneAndAddLabel( - labels, - appsv2beta1.LabelsPodTemplateHashKey, - instance.Status.CoreNodesStatus.CurrentRevision, - ) - } - podList := &corev1.PodList{} _ = k8sClient.List(context.Background(), podList, client.InNamespace(instance.Namespace), - client.MatchingLabels(labels), + client.MatchingLabels( + appsv2beta1.DefaultCoreLabels(instance), + ), ) sort.Slice(podList.Items, func(i, j int) bool { return podList.Items[i].CreationTimestamp.Before(&podList.Items[j].CreationTimestamp)