-
Notifications
You must be signed in to change notification settings - Fork 126
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
Clean up termination config/defaults #1685
Conversation
internal/armada/server/submit.go
Outdated
server.schedulingConfig.MinTerminationGracePeriod.Seconds(), | ||
) | ||
if defaultTerminationGracePeriodSeconds < 0 { | ||
panic("MinTerminationGracePeriod is negative") |
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.
Let's not panic here- if we want to validate config let's do it at startup
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.
Agreed. Let's remove the panic and later add proper config validation at startup.
spec.TerminationGracePeriodSeconds = &defaultTerminationGracePeriod | ||
var podTerminationGracePeriodSeconds int64 | ||
if spec.TerminationGracePeriodSeconds != nil { | ||
podTerminationGracePeriodSeconds = *spec.TerminationGracePeriodSeconds |
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.
we don't verify that *spec.TerminationGracePeriodSeconds is > 0
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.
We have another check that rejects pods with a value less than min.
podTerminationGracePeriodSeconds = *spec.TerminationGracePeriodSeconds | ||
} | ||
if podTerminationGracePeriodSeconds == 0 { | ||
defaultTerminationGracePeriodSeconds := int64( |
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.
why don't we do the conversion once at startup rather than every time? Or even make the config value be an int representing seconds rather than a 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.
I think this is fine. I like having a duration. Since then we can put things like "5m".
For pods that set no grace period or explicitly set it to zero, automatically change it to the minimum allowed. Remove the default grace period setting and instead use the minimum as the default.