From 4df634bb2f68715f1696c39be317c7432bbafa94 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Tue, 26 Dec 2023 17:59:56 +0800 Subject: [PATCH] Fix always renew lease when disconnection from apiserver --- pkg/kwok/controllers/node_lease_controller.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/kwok/controllers/node_lease_controller.go b/pkg/kwok/controllers/node_lease_controller.go index 9e63e1842..008f50924 100644 --- a/pkg/kwok/controllers/node_lease_controller.go +++ b/pkg/kwok/controllers/node_lease_controller.go @@ -146,7 +146,10 @@ func (c *NodeLeaseController) syncWorker(ctx context.Context) { now := c.clock.Now() c.sync(ctx, nodeName) nextTime := c.nextTryTime(nodeName, now) - _ = c.delayQueue.AddAfter(nodeName, nextTime.Sub(now)) + dur := nextTime.Sub(now) + if dur > 0 { + _ = c.delayQueue.AddAfter(nodeName, dur) + } } }