-
Notifications
You must be signed in to change notification settings - Fork 635
After handling status update, reset update timer with correct duration #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After handling status update, reset update timer with correct duration #789
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance you can write a test to show the bug and the fix?
node/node.go
Outdated
@@ -259,10 +259,13 @@ func (n *NodeController) controlLoop(ctx context.Context) error { | |||
return nil | |||
case updated := <-n.chStatusUpdate: | |||
var t *time.Timer | |||
var resetDuration time.Duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can set this before we start the loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this change in the new commit, please take a look.
Personally I think it was more obvious why the reset duration had to be changed when it was bundled with this
Lines 262 to 266 in ba940a9
if n.disableLease { | |
t = pingTimer | |
} else { | |
t = statusTimer | |
} |
logic.
Maybe selecting the active timer could be moved out of the loop as well?
8180607
to
fb6e9c6
Compare
@cpuguy83 I've pushed a new commit with a test that shows this. Without the fix (ping timer is reset to status timer interval):
With the fix:
|
fb6e9c6
to
8e79bb5
Compare
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.
8e79bb5
to
c258614
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looking at this code again, I wonder if we should be resetting the ping timer at all for a node status update.
In any case this looks like a correct fix to the current situation.
Thanks!
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.
Fixes #788