-
Notifications
You must be signed in to change notification settings - Fork 262
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
Use Kueue API types in FlavorAssignerTest #2486
Use Kueue API types in FlavorAssignerTest #2486
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
}.Unflatten(), | ||
}, | ||
requestableResources: resources.FlavorResourceQuantitiesFlat{ | ||
{Flavor: "one", Resource: corev1.ResourceCPU}: 2000, |
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.
note to reviewers: This test started failing once borrowing limit was added (limitation of the Resource constructor - which requires you to specify borrowing limit to set lending limit)
I think the original test didn't match its intention: since previously there was no borrowing limit, the cq wasn't looking for capacity in its cohort, only looking in cq. I changed this value to 2000m, and specified 10000m borrowing limit.
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'm not convinced, if there is no borrowing limit, then the cq is free to borrow within the entire cq.
Would it be feasible to have a new dedicated constructor to let using borrowingLimit =0, so that we are sure we don't drop some coverage?
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.
+1. nil borrowingLimit means "borrow any amount". Please revert numbers.
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.
Sorry, my explaination was wrong, but the test was still broken. See explaination here #2486 (comment)
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.
Looks good, two small comments
9ecf0a4
to
ba89f13
Compare
thanks for the review |
@@ -2373,6 +1993,19 @@ func TestAssignFlavors(t *testing.T) { | |||
} | |||
} | |||
|
|||
func updateResources(dest resources.FlavorResourceQuantities, src resources.FlavorResourceQuantitiesFlat) { |
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.
Can we use the pre-existing Unflatten function for this, like clusterQueue.Usage = tc.clusterQueueUsage.Unflatten()
?
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 could do this in all but one case - a test breaks unfortunately. But I don't like this approach either. We should clean this up in a future PR - by calling some public method of cache or snapshot to get the values we want, rather than manipulating the internal accounting of the CQs/Cohorts
Created #2502
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.
Actually, was able to get rid of guaranteedQuota, as this value is now updated in cache logic.
ResourceGroup( | ||
utiltesting.MakeFlavorQuotas("one"). | ||
Resource(corev1.ResourcePods, "10"). | ||
Resource(corev1.ResourceCPU, "10000m", "1000", "1000m"). |
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.
This borrowing limit "1000" looks suspicious, IIUC it is unbound in the deleted code, which is slightly different semantically, Would there be a way to express "unbound" now? Otherwise maybe Max int 32, but this may mean that we no longer cover cases when borrowingLimit==nil. (same question for some test cases below)
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.
updated the tests to match original semantics
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, nice preparatory pr which will make the following PRs easier to review!
ba89f13
to
2e5eeeb
Compare
2e5eeeb
to
2917889
Compare
/lgtm |
LGTM label has been added. Git tree hash: d4dd3ceb413f316b130f7d4714b22633bd9853a0
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gabesaba, mimowo 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 |
}.Unflatten(), | ||
}, | ||
requestableResources: resources.FlavorResourceQuantitiesFlat{ | ||
{Flavor: "one", Resource: corev1.ResourceCPU}: 2000, |
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.
+1. nil borrowingLimit means "borrow any amount". Please revert numbers.
wlReclaimablePods []kueue.ReclaimablePod | ||
clusterQueue kueue.ClusterQueue | ||
clusterQueueUsage resources.FlavorResourceQuantitiesFlat | ||
clusterQueueGuaranteedQuota resources.FlavorResourceQuantitiesFlat |
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.
this should not be necessary. It should be calculated by the cache logic based on the lendingLimit
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.
after removal, a bunch of tests fail. we can clean up in #2502
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.
Maybe some tests didn't put the right LendingLimit.
Ok.
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 was able to remove guaranteedQuota; I'm not sure what was happening last week (unless I thought you were referring to a different field?)
2917889
to
9f0b496
Compare
{Flavor: "one", Resource: corev1.ResourceCPU}: 2_000, | ||
}, | ||
requestableResources: resources.FlavorResourceQuantitiesFlat{ | ||
{Flavor: "one", Resource: corev1.ResourceCPU}: 2_000, |
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 looks like this was 10_000
before
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.
This test was previously broken/didn't make sense, as it set up the internal state incorrectly. With a lending limit of 0, it should have also set guaranteed quota to 10. I made the minimal update to make it work again. After my change to use the cache, it was failing as the workload actually fit.
I am going to rename, by s/lendinglimit/quota//
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'm pretty sure this test was added when the lendingLimit feature was added. So we are probably missing some coverage on it now. @kerthcet do you recall what was the intention of the test and can you send a PR to fix 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'll take a look later. Thanks for reminding, almost missed 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 couldn't find the case, can anyone point that out?
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.
9f0b496
to
d9a5e72
Compare
LGTM, just one nit to rename the test |
d9a5e72
to
005c37f
Compare
Done. Thanks for the review! |
/lgtm |
LGTM label has been added. Git tree hash: cc59312abc3a5ed7512193dcc10f8fc4bbc5ca0e
|
/hold cancel |
* Define ResourceQuotaWrapper; improve documentation * Update FlavorAssignerTest to use ClusterQueue API types * Add tests for deleted flavor * Improve readability of test quantities
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
We update the FlavorAssignerTest to use Kueue API types, rather than construct CQ/Cohort snapshot manually. This will allow us to change CQ/Cohort Snapshot logic without updating the tests each time.
Preparation for main changes in #79
Does this PR introduce a user-facing change?