Skip to content

Conversation

@IrvingMg
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Adds unit tests for sortedDomainsWithLeader to document and verify its sorting behavior.

Which issue(s) this PR fixes:

Closes #8178

Special notes for your reviewer:

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 Dec 12, 2025
@netlify
Copy link

netlify bot commented Dec 12, 2025

Deploy Preview for kubernetes-sigs-kueue ready!

Name Link
🔨 Latest commit 5db2e50
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/693bf8e50ffe5a00088b001b
😎 Deploy Preview https://deploy-preview-8207--kubernetes-sigs-kueue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 12, 2025
@IrvingMg
Copy link
Contributor Author

The current behavior seems to be correct. In the sortedDomainsWithLeader function, only sliceStateWithLeader changes depending on the algorithm. stateWithLeader is only used to break ties and is always sorted in ascending order. This matches how sortedDomains works, where the state is always sorted ascending to help prioritize domains that can fit slices with minimal leftover capacity.

// This function sorts domains based on a specified algorithm: BestFit or LeastFreeCapacity.
//
// The sorting criteria are:
// - **BestFit**: `sliceState` (descending), `state` (ascending), `levelValues` (ascending)
// - **LeastFreeCapacity**: `sliceState` (ascending), `state` (ascending), `levelValues` (ascending)
//
// `state` is always sorted ascending. This prioritizes domains that can accommodate slices with minimal leftover pod capacity.
func (s *TASFlavorSnapshot) sortedDomains(domains []*domain, unconstrained bool) []*domain {

/cc @PBundyra @mimowo

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

Labels

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. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TAS] Investigate LeastFreeCapacity algorithm for TAS podset groups

2 participants