add default_ineligible configuration option#13082
Conversation
jrasell
left a comment
There was a problem hiding this comment.
Hi @wjordan and thanks for taking an initial pass at this. I have added some inline comments around the functionality.
I am also curious of how this approach would work. If the value is set via a config file value, would the operator be expected to modify this value and then restart the agent?
The Nomad API also includes a method for updating node eligibility which operators could use. If this was the case, and the agent restarted (crash or otherwise) would the config value override what the API call did?
There was a problem hiding this comment.
This nil check is a safety check to avoid a panic in the event the node config object is not correctly set. If we chase the function calls from this client.setupNode call we see:
- it is called by
client.NewClientwhich comes fromagent.setupClient - the
agent.setupClientfunction includes a call toagent.clientConfig agent.clientConfigcallsconvertClientConfigwhich performs a number of node struct setup items
Therefore during normal and hopefully every client setup this condition is never hit and therefore the eligibility toggle is not used.
There was a problem hiding this comment.
This test seems like it is attempting to match the exact conditions seen within the code which as previously noted is a bit of a red herring.
e649855 to
cb2484b
Compare
|
Thanks @jrasell for quick feedback and pointing me in the right direction with the implementation. I've updated the code to pass I've updated the test as well. Please take a look and let me know if this is headed in the right direction! |
|
To answer your questions:
The intended behavior is to only apply the config value as an initial default for newly-registered nodes, so the operator would be expected to set this via a config file value before starting the agent the first time.
No, the config value is only intended to allow configuring the default for newly-registered nodes, so it wouldn't override anything once the node has been registered. |
8467d86 to
31e6a62
Compare
31e6a62 to
abc5188
Compare
|
Third attempt at this in abc5188, just set the client node's This value will be sent to the server on the initial registration. Re-registering an existing node (e.g., on agent restart) should already correctly preserve the existing value, thanks to existing logic in nomad/nomad/state/state_store.go Line 896 in 5b5c853 |
|
any update on this? was surprised that this isn't supported yet. |
|
Are there any updates on this? |
|
Any updates on this change? |
|
@wjordan would you be able to rebase the PR? If not, mind if I reissue it to get this feature merged by the hashicorp folks? |
Specifies if scheduling eligibility should be disabled by default for new client nodes.
improve test, per review
|
@wjordan I did not intend to push to your fork (I assumed I wouldn't have permissions) but if you are still following this PR and would like to add these test fixes from the PR I opened. I'd be happy to merge your PR instead. |
Specifies if scheduling eligibility should be disabled by default for new client nodes.
Fixes #13081, see this issue for discussion of the use-case.