-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Add PodDisruptionBudget support in pod preemption #56178
Conversation
@davidopp This is my PR to add support for PDB. Could you please add milestone? |
@@ -776,6 +809,45 @@ func nodePassesExtendersForPreemption( | |||
return true, nil | |||
} | |||
|
|||
// filterPodsWithPDBViolation groups the given "pods" into two groups of "violatedPos" |
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.
violatedPods
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.
Done
func selectVictimsOnNode( | ||
pod *v1.Pod, | ||
meta algorithm.PredicateMetadata, | ||
nodeInfo *schedulercache.NodeInfo, | ||
fitPredicates map[string]algorithm.FitPredicate, | ||
queue SchedulingQueue, | ||
) ([]*v1.Pod, bool) { | ||
pdbs []*policy.PodDisruptionBudget, | ||
) ([]*v1.Pod, int, bool) { |
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.
Update the function-level comment to explain how you use PDB.
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.
Done
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.
Thanks, @davidopp! Addressed the comments and added more integration tests. No other logic changes. PTAL.
@@ -776,6 +809,45 @@ func nodePassesExtendersForPreemption( | |||
return true, nil | |||
} | |||
|
|||
// filterPodsWithPDBViolation groups the given "pods" into two groups of "violatedPos" |
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.
Done
func selectVictimsOnNode( | ||
pod *v1.Pod, | ||
meta algorithm.PredicateMetadata, | ||
nodeInfo *schedulercache.NodeInfo, | ||
fitPredicates map[string]algorithm.FitPredicate, | ||
queue SchedulingQueue, | ||
) ([]*v1.Pod, bool) { | ||
pdbs []*policy.PodDisruptionBudget, | ||
) ([]*v1.Pod, int, bool) { |
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.
Done
initPausePod(context.clientSet, &pausePodConfig{ | ||
Name: "low-pod3", | ||
Namespace: context.ns.Name, | ||
Priority: &lowPriority, |
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'd suggest to make this &mediumPriority so it exactly matches node-1 except for violating more PDBs
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.
Done.
Looks great, just had one small comment. |
Thanks a lot, @davidopp for your prompt review. PTAL. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, davidopp Associated issue: 53913 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/kind feature |
PR is LGTM and approved, just awaiting auto-merge. |
[MILESTONENOTIFIER] Milestone Pull Request Current @bsalamat @davidopp @k82cn @resouer Note: This pull request is marked as Example update:
Pull Request Labels
|
I wonder why this has not auto-merged yet. |
Automatic merge from submit-queue (batch tested with PRs 55952, 49112, 55450, 56178, 56151). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
This PR adds the logic to make scheduler preemption aware of PodDisruptionBudget. Preemption tries to avoid preempting pods whose PDBs are violated by preemption. If preemption does not find any other pods to preempt, it will preempt pods despite violating their PDBs.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #53913
Special notes for your reviewer:
Release note:
ref/ #47604
/sig scheduling