Skip to content

Commit

Permalink
fix: selector pod to request EMQX API
Browse files Browse the repository at this point in the history
some times operator controller will pick deleted pod to request EMQX API

Signed-off-by: Rory Z <[email protected]>
  • Loading branch information
Rory-Z committed Mar 6, 2024
1 parent 22a0cf7 commit 5c3cbf4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/apps/v2beta1/emqx_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func newRequester(ctx context.Context, k8sClient client.Client, instance *appsv2
})

for _, pod := range podList.Items {
if pod.Status.Phase == corev1.PodRunning && pod.Status.PodIP != "" {
if pod.GetDeletionTimestamp() == nil && pod.Status.Phase == corev1.PodRunning && pod.Status.PodIP != "" {
return &innerReq.Requester{
Schema: schema,
Host: net.JoinHostPort(pod.Status.PodIP, port),
Expand Down

0 comments on commit 5c3cbf4

Please sign in to comment.