-
Notifications
You must be signed in to change notification settings - Fork 286
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 comments to explain special cases #1496
Add comments to explain special cases #1496
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
I agree that if the CQ doesn't belong to a cohort, the borrowingLimit should be considered 0. |
/retest pull-kueue-test-unit-main |
@kerthcet: The
Use In response to this:
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. |
/test pull-kueue-test-unit-main |
aa8cfba
to
dbaea07
Compare
@@ -334,12 +336,15 @@ func workloadFits(wlReq cache.FlavorResourceQuantities, cq *cache.ClusterQueue, | |||
} | |||
for rName, rReq := range flvReq { | |||
limit := flvQuotas.Resources[rName].Nominal | |||
if flvQuotas.Resources[rName].BorrowingLimit != nil && allowBorrowing { | |||
|
|||
if cq.Cohort != nil && allowBorrowing && flvQuotas.Resources[rName].BorrowingLimit != nil { |
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.
Based on the comment:
// If null, it means that there is no borrowing limit.
// If not null, it must be non-negative.
// borrowingLimit must be null if spec.cohort is empty.
// +optional
BorrowingLimit *resource.Quantity `json:"borrowingLimit,omitempty"`
If borrowingLimit is nil then cohort must be nil, no bug here. However, we didn't have any validation about this, that's say we can still have cq with cohort == nil && borrowingLimit != nil
.
My suggestion here: #1385 (comment), tl;dr: can we ignore this rule? cc @alculquicondor
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.
cc @B1F030
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 is a pity we don't have validation against cq.Cohort=nil
and borrowingLimit!=nil
.
Maybe it is still not too late to add, Kueue is still Beta API?
Anyway, if we go with the check for cq.Cohort != nil
, should we also add it here?
@@ -64,7 +64,7 @@ func (p *Preemptor) OverrideApply(f func(context.Context, *kueue.Workload) error | |||
} | |||
|
|||
func candidatesOnlyFromQueue(candidates []*workload.Info, clusterQueue string) []*workload.Info { | |||
result := make([]*workload.Info, 0) | |||
result := make([]*workload.Info, 0, len(candidates)) |
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.
nit: I would suggest to revert unrelated changes
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.
also, all the workloads might be from a different CQ.
So it could be better to do var result []*workload.Info
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's clear here that the length wouldn't greater than len(candidates).
Signed-off-by: kerthcet <[email protected]>
dbaea07
to
ccd30b5
Compare
As you reminded, we're beta now, we can not break the API semantics, so made it a cleanup. And will add the validations about the API. Maybe we can change that at v1beta2 if needed. PTAL @mimowo |
/remove-kind bug |
Signed-off-by: kerthcet <[email protected]>
Next, I'll add more validations to avoid this. |
I write a part of validation in webhook |
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.
/approve
/lgtm
LGTM label has been added. Git tree hash: 656842d66315b72d236829a12304bfdb4fa45b12
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor, kerthcet 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 |
* code refactor Signed-off-by: kerthcet <[email protected]> * fix comment Signed-off-by: kerthcet <[email protected]> --------- Signed-off-by: kerthcet <[email protected]>
What type of PR is this?
/kind bug
What this PR does / why we need it:
Based on my understanding, evenborrowlingLimit
not nil, ifcq.cohort == nil
, we should still not consider the borrowingLimit in calculation. cc @alculquicondor is this a real bug or as designed?Just for explaination.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?