Skip to content

Commit

Permalink
fix: selector pod to request EMQX API
Browse files Browse the repository at this point in the history
Signed-off-by: Rory Z <[email protected]>
  • Loading branch information
Rory-Z committed Oct 9, 2023
1 parent a32a33e commit b34242e
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions controllers/apps/v2beta1/emqx_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b34242e

Please sign in to comment.