From 1e4cc24fc231c436958bf0e7a9cd6d5da3445e47 Mon Sep 17 00:00:00 2001 From: Diego Ciangottini Date: Wed, 3 Jul 2024 09:53:06 +0200 Subject: [PATCH] Avoid remote status requests with 0 pods --- pkg/virtualkubelet/virtualkubelet.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/virtualkubelet/virtualkubelet.go b/pkg/virtualkubelet/virtualkubelet.go index 95e20c32..bda0e7b2 100644 --- a/pkg/virtualkubelet/virtualkubelet.go +++ b/pkg/virtualkubelet/virtualkubelet.go @@ -706,7 +706,7 @@ func (p *VirtualKubeletProvider) statusLoop(ctx context.Context) { } } - if podsList != nil { + if len(podsList) > 0 { _, err = checkPodsStatus(ctx, p, podsList, string(b), p.config) if err != nil { log.G(ctx).Error(err) @@ -718,6 +718,8 @@ func (p *VirtualKubeletProvider) statusLoop(ctx context.Context) { } p.pods[key] = pod } + } else { + log.G(ctx).Info("No pods to monitor, waiting for the next loop to start") } log.G(ctx).Info("statusLoop=end")