Skip to content

scheduler_perf: create pods and PodGroups from the group ops - #143388

Open
yashaggarwal85d wants to merge 2 commits into
kubernetes:masterfrom
yashaggarwal85d:scheduler-perf-inline-podgroup-ops
Open

yashaggarwal85d wants to merge 2 commits into
kubernetes:masterfrom
yashaggarwal85d:scheduler-perf-inline-podgroup-ops

Conversation

@yashaggarwal85d

Copy link
Copy Markdown

What type of PR is this?

/kind cleanup
/sig scheduling
/wg workload-aware-scheduling

What this PR does / why we need it:

Follow-up from #141706. createPodGroups now has an optional pods (a createPods spec) and podsPerGroup/podsPerGroupParam, and createCompositePodGroups has an optional podGroups. The nested op gets its count and namespace from the parent, and podsPerGroup / parentLevel / childrenPodGroupsPerCPG are passed to its template. That lets us drop countMultiplierParam, the $podGroupsCount and $parentLevel params that createCompositePodGroups used to write into the workload params, and params.set. All configs that used the old pattern are moved over. Standalone createPodGroups and createPods still work as before.

Which issue(s) this PR is related to:

Fixes #143281

Special notes for your reviewer:

Ran go test ./test/integration/scheduler_perf/ and the TestSchedulerPerf integration tests (short and non-short) for cpg, podgroup/..., default_preemption and workload_preemption.

Does this PR introduce a user-facing change?

NONE

AI usage disclosure:

YES. This PR was written in part with the assistance of generative AI (drafting the change and migrating the configs). I reviewed and tested it, and I'm responsible for the changes.

@kubernetes-prow kubernetes-prow Bot added 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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. wg/workload-aware-scheduling Categorizes issue or PR as relevant to workload-aware scheduling WG. labels Oct 25, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in SIG Scheduling Oct 25, 2026
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 25, 2026
@kubernetes-prow kubernetes-prow Bot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 25, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @yashaggarwal85d. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

@kubernetes-prow

Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Details

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-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Oct 25, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yashaggarwal85d
Once this PR has been reviewed and has the lgtm label, please assign tosi3k for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@kubernetes-prow
kubernetes-prow Bot requested review from damemi and denkensk October 25, 2026 06:18
@pacoxu

pacoxu commented Oct 26, 2026

Copy link
Copy Markdown
Member

/ok-to-test

/test pull-kubernetes-scheduler-perf

/cc @iomarsayed

@kubernetes-prow
kubernetes-prow Bot requested a review from iomarsayed October 26, 2026 09:20
@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 26, 2026
@yashaggarwal85d
yashaggarwal85d force-pushed the scheduler-perf-inline-podgroup-ops branch from e885c5e to 699e57f Compare October 27, 2026 05:15
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 27, 2026
@iomarsayed

Copy link
Copy Markdown
Contributor

/assign

@iomarsayed iomarsayed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for taking this. Here are my first set of comments.

// It creates the configured number of PodGroups from a template and
// then waits for them to be visible in the scheduler's informer cache.
// This ensures that subsequent operations (like creating pods that reference these pod groups) won't fail due to cache lag.
// This ensures that the pods referencing these pod groups won't fail due to cache lag.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the old comment still applies, let's just change the word subsequent because it is not the most accurate anymore:

Suggested change
// This ensures that the pods referencing these pod groups won't fail due to cache lag.
// This ensures that dependent operations (like creating pods that reference these pod groups) won't fail due to cache lag.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Made the suggested change

Comment on lines +672 to +679
PodsPerGroup int
// PodsPerGroupParam is the name of the parameter that determines PodsPerGroup.
PodsPerGroupParam string
// Pods describes the pods that get created for these PodGroups once they are cached.
// Count and Namespace must not be set, they are derived from the PodGroups.
// podsPerGroup is passed to the pod template.
// Optional.
Pods *createPodsOp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please let's rename this variable into the operation name: createPodsOp.
It will have a better reflection in configs and readability.

Also this field cannot be optional, It is not sensible to have a CPG tree without PodGroups for our scheduler perf tests.
Let's also add tests to ensure this field is present.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Made the suggested change

// Count and Namespace must not be set, they are derived from the hierarchy.
// parentLevel and childrenPodGroupsPerCPG are passed to the PodGroup template.
// Optional.
PodGroups *createPodGroups

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment, please let's rename this variable into the operation name: createPodGroupsOp.
It will have a better reflection in configs and readability.

Also this field cannot be optional, It is not sensible to have a CPG tree without PodGroups for our scheduler perf tests.
Let's also add tests to ensure this field is present.

@yashaggarwal85d yashaggarwal85d Oct 29, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Renamed!
But For createPodGroups I kept it optional for now because dra/workloadresourceclaims and starvation still use createPodGroups on its own

Comment on lines +282 to +283
// This ensures that the PodGroups referencing these CompositePodGroups won't fail due to cache lag.
// If op.PodGroups is set, it then creates the leaf PodGroups.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

if cpg.TemplatePath == "" {
return fmt.Errorf("templatePath must be set")
}
if cpg.Pods == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once the operation field is not optional, this validation should be adjusted to return an error immediately.

if err := cpg.isValid(false); err != nil {
return nil, err
}
if cpg.Pods != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once the operation field is not optional, we don't need this check anymore, where isValid() will check for it and fail immedaitely.

if !allowParameterization && ccpg.ChildrenPodGroupsPerCPG < 1 {
return fmt.Errorf("childrenPodGroupsPerCPG must be greater than 0, got %d", ccpg.ChildrenPodGroupsPerCPG)
}
if ccpg.PodGroups != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here: Once the operation field is not optional, this validation should be adjusted to return an error immediately.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, it returns an error now if createPodGroupOp isn't set

@yashaggarwal85d
yashaggarwal85d force-pushed the scheduler-perf-inline-podgroup-ops branch from e697a88 to bab6463 Compare October 28, 2026 17:03
@yashaggarwal85d

yashaggarwal85d commented Oct 29, 2026 •

Copy link
Copy Markdown
Author

Hey @iomarsayed, thanks for the review, I was making these changes and forgot to reply. Thanks for waiting. I have made some fixes as suggested. lemme reply to the comments as well

@yashaggarwal85d

yashaggarwal85d commented Oct 29, 2026 •

Copy link
Copy Markdown
Author

In DRA, measurePods is a total that the pod template spreads round-robin with Mod.Index.PodGroupCount, so per-group creation would change which pods land in which group. Starvation runs a churn op between creating the PodGroup and the pods. Do you want me to move those over in this PR too, or keep it optional for those cases?

@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2026
@yashaggarwal85d
yashaggarwal85d force-pushed the scheduler-perf-inline-podgroup-ops branch from bab6463 to 0340d75 Compare October 31, 2026 06:55
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 31, 2026
@yashaggarwal85d

Copy link
Copy Markdown
Author

/test pull-kubernetes-unit

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/test 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. wg/workload-aware-scheduling Categorizes issue or PR as relevant to workload-aware scheduling WG.

Projects

Status: Needs Triage
Status: Backlog

Development

Successfully merging this pull request may close these issues.

scheduler-perf: inline createPods inside createPodGroups and createPodGroups inside createCompositePodGroups.

3 participants