-
Notifications
You must be signed in to change notification settings - Fork 2k
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
scheduler: allow configuring default preemption for system scheduler #6935
Conversation
Some operators want a greater control over when preemption is enabled, especially during an upgrade to limit potential side-effects.
command/agent/config.go
Outdated
@@ -444,6 +444,9 @@ type ServerConfig struct { | |||
// ServerJoin contains information that is used to attempt to join servers | |||
ServerJoin *ServerJoin `hcl:"server_join"` | |||
|
|||
// SystemSchedulerPreemptionEnabledDefault is used to determin whether to enable system preemption by default in a new cluster |
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.
s/determin/determine here and everywhere else below
BTW - I would love a better name than
It's a bit more generic and can handle future scheduler configurations and support more use cases (e.g. enabling batch and service preemption). |
command/agent/config.go
Outdated
@@ -444,6 +444,9 @@ type ServerConfig struct { | |||
// ServerJoin contains information that is used to attempt to join servers | |||
ServerJoin *ServerJoin `hcl:"server_join"` | |||
|
|||
// SystemSchedulerPreemptionEnabledDefault is used to determin whether to enable system preemption by default in a new cluster | |||
SystemSchedulerPreemptionEnabledDefault *bool `hcl:"system_scheduler_preemption_enabled_default"` |
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 if we added a Defaults
struct for this field so we can reuse it for all API configured settings? I think we should provide file-configurable-defaults for all scheduler configuration parameters to better support Packer & TF users who don't want to have to run some commands to tweak their cluster post deployment.
Then hcl files baked into golden images would look something like:
server {
enabled = true
# ... a bunch of other stuff ...
defaults {
system_scheduler_preemption = false
}
}
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.
Ha, just noticed your comment above saying almost the exact same thing @notnoop. 😅
Another naming idea based off of yours:
server {
enabled = true
# ... a bunch of other stuff ...
scheduler_defaults {
system_job_preemption = false
}
}
We can drop _enabled
as other bool fields don't have it. Otherwise I think some sort of qualifier is necessary for "system" as shortening it to system_preemption
may not be immediately obvious to users that its referring to system jobs since the word "system" is quite generic.
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 agree: a generic defaults make sense. Though, I would prefer to use the same json format or key names that the API accepts. Given that the API is the canonical way for configuration, I opted to use the same API terms as-is. Making them hcl-friendly risks hcl format being behind/divergent from the api format and complicates documentation/implementation.
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.
Ah right, we should probably follow the jobspec's lead here:
- The style should vary by format (underscores for HCL, Caps for JSON)
- Otherwise the names should match
2d84f54
to
31025d6
Compare
Don't forget docs and changelog (of course I only remembered those after hitting "Approved") |
I'll follow up with docs in follow up PR. |
ref #7010 for docs |
scheduler: allow configuring default preemption for system scheduler
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Some operators want a greater control over when preemption is enabled,
especially during an upgrade to limit potential side-effects.
However, I lean towards exposing it as a general flag. The preemption code is relatively new and had few panic bugs (e.g. #6792 and #5794), so it's understandable that operators would like to control its enablement more. Additional, current server config parameters[1] have many esoteric knobs, and I suspect this flag passes that threshold. Granted, disabling preemption can lead to surprising behavior (e.g. system jobs not running on every node), and operators should be warned in our docs/guides. I'm open for alternative views.
[1] https://www.nomadproject.io/docs/configuration/server.html#server-parameters