Skip to content
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

TAS: introduce scheduler-level tests #3361

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

mimowo
Copy link
Contributor

@mimowo mimowo commented Oct 29, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

To do not work-around accounting for TAS pods and workloads.

Which issue(s) this PR fixes:

Part of #2724

Special notes for your reviewer:

This was ticked as "Account for usage from TAS workloads in the unit tests for cache" in the spreadsheet.
I'm going to expand the tests in follow up tasks.
I moved already the most "workaround"-ish test, but I could move tests in the future, let me know.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Oct 29, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 29, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 29, 2024
Copy link

netlify bot commented Oct 29, 2024

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 76b817c
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/6721ce1b14dff7000882bbf2

@mimowo
Copy link
Contributor Author

mimowo commented Oct 29, 2024

/cc @PBundyra @tenzen-y

@mimowo mimowo changed the title TAS: introduce scheduled-level tests WIP: TAS: introduce scheduled-level tests Oct 29, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 29, 2024
@mimowo mimowo changed the title WIP: TAS: introduce scheduled-level tests WIP: TAS: introduce scheduler-level tests Oct 29, 2024
@mimowo mimowo force-pushed the tas-scheduler-level-tests branch from 0660f4e to 39bb53e Compare October 29, 2024 16:39
@mimowo mimowo changed the title WIP: TAS: introduce scheduler-level tests TAS: introduce scheduler-level tests Oct 29, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 29, 2024
@mimowo mimowo changed the title TAS: introduce scheduler-level tests WIP: TAS: introduce scheduler-level tests Oct 29, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 29, 2024
@mimowo mimowo force-pushed the tas-scheduler-level-tests branch from 39bb53e to 441cecd Compare October 29, 2024 17:09
@mimowo mimowo changed the title WIP: TAS: introduce scheduler-level tests TAS: introduce scheduler-level tests Oct 29, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 29, 2024
if in.Spec.Preemption != nil {
c.Preemption = *in.Spec.Preemption
} else {
c.Preemption = defaultPreemption
}

c.UpdateWithFlavors(resourceFlavors)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: The new unit test discovered this subtle bug - the UpdateWithFlavors requires the Preemption to be set, so that the check for Preemption.withinClusterQueue != "Never" is correct (otherwise it is "", so considered not equal, and the CQ is inactivated).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this bug in the flow (c.UpdateWithFlavors() -> c.updateQueueStatus() -> c.isTASViolated()) and (c.updateWithAdmissionChecks() -> c.updateQueueStatus() -> c.isTASViolated()).

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 30, 2024
@@ -805,51 +801,6 @@ func TestFindTopologyAssignment(t *testing.T) {
},
},
},
"don't double-count TAS pods when computing the capacity": {
Copy link
Contributor Author

@mimowo mimowo Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this scenario is moved to the new suite as "workload gets scheduled as the usage of TAS pods and workloads is not double-counted", since it was tricky to account for the Workloads' usage in this setup (see comment below). So the test used to create a "TAS" Pod, but it didn't belong to any TAS workload. The new suite allows to account for Workloads and Pods.

@mimowo
Copy link
Contributor Author

mimowo commented Oct 30, 2024

/cc @mbobrovskyi

@mbobrovskyi
Copy link
Contributor

/lgtm

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 05b191c81bebb6a951f3d178648642045d9b82eb

@k8s-ci-robot k8s-ci-robot merged commit 5ce02ea into kubernetes-sigs:main Oct 30, 2024
16 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.9 milestone Oct 30, 2024
if in.Spec.Preemption != nil {
c.Preemption = *in.Spec.Preemption
} else {
c.Preemption = defaultPreemption
}

c.UpdateWithFlavors(resourceFlavors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this bug in the flow (c.UpdateWithFlavors() -> c.updateQueueStatus() -> c.isTASViolated()) and (c.updateWithAdmissionChecks() -> c.updateQueueStatus() -> c.isTASViolated()).


ctx, cancel := context.WithTimeout(ctx, queueingTimeout)
go qManager.CleanUpOnContext(ctx)
defer cancel()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defer cancel()
t.Cleanup(cancel())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it was copy-pasted from here. I think it warrants a cleanup PR which fixes all tests, otherwise people will continue to copy-paste the old pattern. Opened: #3382

EventType: corev1.EventTypeNormal,
},
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if more than one flavor was assigned to a single resource like

} else if *result != v.Name {
?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check was added proactively. I'm not sure how to trigger it e2e (or if this is possible). I will investigate separately, added a point in the spreadsheet as "Investigate if possible to have two flavors for the same resource"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this to the sheet.

kannon92 pushed a commit to openshift-kannon92/kubernetes-sigs-kueue that referenced this pull request Nov 19, 2024
* TAS: introduce scheduled-level tests

* some test cleanups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants