-
Notifications
You must be signed in to change notification settings - Fork 669
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
Redefine IsEvictable to be customizable for a particular strategy #372
Conversation
@@ -187,6 +152,66 @@ func evictPod(ctx context.Context, client clientset.Interface, pod *v1.Pod, poli | |||
return err | |||
} | |||
|
|||
type constraint func(pod *v1.Pod) error | |||
|
|||
type evictable struct { |
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.
It seems odd that this is a private type but all the functions that work with it are public. Might be better as a public type, and then if we add more options to it in the future, it could be declared as a literal
I'm not sure on the name, I think something like EvictOptions
might be clearer. wdyt?
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.
That was the idea. Keep the actual implementation hidden and just rely on a single IsEvictable
invocation. I have created Options
struct instead of having WithPriorityThreshold
as a method.
2cc9676
to
5d9bee8
Compare
5d9bee8
to
6f27712
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.
one nit on a comment but the rest looks good at this point
/approve
/hold
feel free to remove the hold whenever you're ready
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: damemi, ingvagabund The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Use WithXXX methods to extend the list of constraints to also provide a reasonable error message.
6f27712
to
d8251b9
Compare
/hold cancel |
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
/kind cleanup |
Redefine IsEvictable to be customizable for a particular strategy
Use WithXXX methods to extend the list of constraints to also
provide a reasonable error message.