-
Notifications
You must be signed in to change notification settings - Fork 38.9k
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: merge Reserve and Unreserve plugins #92200
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Welcome @adtac! |
Hi @adtac. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
CLA signed. |
/ok-to-test |
37f5a20
to
bf2a5df
Compare
pkg/scheduler/apis/config/types.go
Outdated
@@ -192,8 +192,8 @@ type Plugins struct { | |||
// Score is a list of plugins that should be invoked when ranking nodes that have passed the filtering phase. | |||
Score *PluginSet | |||
|
|||
// Reserve is a list of plugins invoked when reserving a node to run the pod. | |||
Reserve *PluginSet | |||
// Reservation is a list of plugins invoked when reserving and unreserving a node to run the pod. |
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 would prefer that we keep the name Reserve
to avoid increasing the backwards-incompatible changes from v1alpha2 to v1beta1.
I don't think the name Reserve is deceiving. We have Score
, which has 2 functions: Score
and NormalizeScore
.
WDYT @ahg-g @Huang-Wei ?
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.
keeping the name Reserve sgtm.
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.
pkg/scheduler/framework/plugins/examples/multipoint/multipoint.go
Outdated
Show resolved
Hide resolved
// Run "reserve" plugins. | ||
if sts := prof.RunReservePlugins(schedulingCycleCtx, state, assumedPod, scheduleResult.SuggestedHost); !sts.IsSuccess() { | ||
// Run the Reserve method of reservation plugins. | ||
if sts := prof.RunReserveReservationPlugins(schedulingCycleCtx, state, assumedPod, scheduleResult.SuggestedHost); !sts.IsSuccess() { | ||
sched.recordSchedulingFailure(prof, assumedPodInfo, sts.AsError(), SchedulerError, "") |
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.
Here we should call Unreserve #83557
We will need a test for it.
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 like to implement the merge of the two plugins first and then handle the case of failing reserves later in a separate PR to keep this PR small, atomic, and contained to one issue.
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.
Could I recreate #83557 after this PR will be merged?
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.
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 like to see this feature to completion, but if you'd strongly like to work on that feature after this PR, I don't mind :)
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.
Oh, I misunderstood. I have nothing to do :)
94f6d2c
to
3bbfda5
Compare
The go fmt errors seem to be unrelated to my PR? |
Probably #92402 ? |
staticcheck is failing, but gofmt is failing too and it seems like that issue doesn't cover that |
/retest |
/retest |
Previously, separate interfaces were defined for Reserve and Unreserve plugins. However, in nearly all cases, a plugin that allocates a resource using Reserve will likely want to register itself for Unreserve as well in order to free the allocated resource at the end of a failed scheduling/binding cycle. Having separate plugins for Reserve and Unreserve also adds unnecessary config toil. To that end, this patch aims to merge the two plugins into a single interface called a ReservePlugin that requires implementing both the Reserve and Unreserve methods.
/lgtm |
/hold cancel /retest |
/retest Review the full test history for this PR. Silence the bot with an |
5 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
@adtac: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest |
What type of PR is this?
/kind api-change
What this PR does / why we need it:
Previously, separate interfaces were defined for Reserve and Unreserve
plugins. However, in nearly all cases, a plugin that allocates a
resource using Reserve will likely want to register itself for Unreserve
as well in order to free the allocated resource at the end of a failed
scheduling/binding cycle. Having separate plugins for Reserve and
Unreserve also adds unnecessary config toil. To that end, this patch
aims to merge the two plugins into a single interface called a
ReservationPlugin that requires implementing both the Reserve and
Unreserve methods.
Which issue(s) this PR fixes:
Fixes #90724
Special notes for your reviewer:
Does this PR introduce a user-facing change?: