From c258614d8f7139ea7c03f685bab9fb3b9f88bc8c Mon Sep 17 00:00:00 2001 From: Thomas Hartland Date: Mon, 4 Nov 2019 10:47:53 +0100 Subject: [PATCH] After handling status update, reset update timer with correct duration If the ping timer is being used, it should be reset with the ping update interval. If the status update interval is used then Ping stops being called for long enough to cause kubernetes to mark the node as NotReady. --- node/node.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/node/node.go b/node/node.go index 59ce9d674..702be8f21 100644 --- a/node/node.go +++ b/node/node.go @@ -244,7 +244,12 @@ func (n *NodeController) controlLoop(ctx context.Context) error { statusTimer := time.NewTimer(n.statusInterval) defer statusTimer.Stop() + timerResetDuration := n.statusInterval if n.disableLease { + // when resetting the timer after processing a status update, reset it to the ping interval + // (since it will be the ping timer as n.disableLease == true) + timerResetDuration = n.pingInterval + // hack to make sure this channel always blocks since we won't be using it if !statusTimer.Stop() { <-statusTimer.C @@ -276,7 +281,7 @@ func (n *NodeController) controlLoop(ctx context.Context) error { if err := n.updateStatus(ctx, false); err != nil { log.G(ctx).WithError(err).Error("Error handling node status update") } - t.Reset(n.statusInterval) + t.Reset(timerResetDuration) case <-statusTimer.C: if err := n.updateStatus(ctx, false); err != nil { log.G(ctx).WithError(err).Error("Error handling node status update")