-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Dynamically update node inventory #1374
Dynamically update node inventory #1374
Conversation
Current coverage is 55.38% (diff: 41.50%)@@ master #1374 diff @@
==========================================
Files 82 82
Lines 12856 12871 +15
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 7101 7129 +28
+ Misses 4774 4772 -2
+ Partials 981 970 -11
|
It looks like |
I confirmed that there are no issues on the Docker side as far as this PR is concerned, but it depends on #1426. I'm currently running some more tests, and would appreciate if someone could also volunteer to test it out on their machine. The one thing that might need tuning is nodeUpdatePeriod = 20 * time.Second |
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
3f8ae63
to
e245073
Compare
cc @aaronlehmann - I moved the node update code to a separate function, which can be reused both during node registration and update. The relevant changes are in Please let me know if this is the correct way to do it. This PR works with that change. |
// updateNode updates the description of a node and sets status to READY | ||
// this is used during registration when a new node description is provided | ||
// and during node updates when the node description changes | ||
func (d *Dispatcher) updateNode(nodeID string, description *api.NodeDescription) (string, error) { |
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.
What is this return value for?
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.
Good catch, it's not needed. I copied some code from register()
that was returning two values and didn't change it.
e245073
to
26bdb37
Compare
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
26bdb37
to
8fa5bcd
Compare
LGTM |
In my testing (mostly with changing daemon labels), the behavior is fairly stable, barring the occasional error:
This is not surprising, since updating restarts the engine, and there's a brief period it's unavailable. It's not a problem though, since we just ignore when that happens and try again later (which is to say nothing bad happens when the engine is unavailable). I'm thinking that we could change the above error message to a warning perhaps if required, or else just keep it the way it is. |
LGTM |
Ping @docker/core-swarmkit-maintainers it would be great if someone could test this on their machine too. If there are no further concerns, we can merge it. |
@stevvooe You should merge this. |
This PR makes the node inventory dynamic i.e. changes to node info are passed to the dispatcher. A ticker checks the node info periodically (currently every 20 seconds) and closes the session if changes are found, so that a new one can be created with an updated node description, and the same session id.
I'm trying to test this change thoroughly since it can likely cause race conditions in the main agent loop. The update period will likely have to be tuned to make sure that it doesn't interfere with the agent's backoff mechanism.
The underlying assumption is that node updates aren't super frequent.
Follow up to #1174 after it had to be reverted due to unstable behavior. #1230 was meant to fix some of that.
Fix #279
Signed-off-by: Nishant Totla nishanttotla@gmail.com