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

[release-0.7] [fix] update assignedFlavorIdx at the beginning of loop #2440

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pkg/scheduler/flavorassigner/flavorassigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,10 @@ func (a *FlavorAssigner) findFlavorForPodSetResource(

// We will only check against the flavors' labels for the resource.
selector := flavorSelector(podSpec, resourceGroup.LabelKeys)
assignedFlavorIdx := -1
attemptedFlavorIdx := -1
idx := a.wl.LastAssignment.NextFlavorToTryForPodSetResource(psID, resName)
for ; idx < len(resourceGroup.Flavors); idx++ {
attemptedFlavorIdx = idx
flvQuotas := resourceGroup.Flavors[idx]
flavor, exist := a.resourceFlavors[flvQuotas.Name]
if !exist {
Expand All @@ -426,8 +427,6 @@ func (a *FlavorAssigner) findFlavorForPodSetResource(
status.append(fmt.Sprintf("flavor %s doesn't match node affinity", flvQuotas.Name))
continue
}

assignedFlavorIdx = idx
needsBorrowing := false
assignments := make(ResourceAssignment, len(requests))
// Calculate representativeMode for this assignment as the worst mode among all requests.
Expand Down Expand Up @@ -477,11 +476,11 @@ func (a *FlavorAssigner) findFlavorForPodSetResource(

if features.Enabled(features.FlavorFungibility) {
for _, assignment := range bestAssignment {
if assignedFlavorIdx == len(resourceGroup.Flavors)-1 {
if attemptedFlavorIdx == len(resourceGroup.Flavors)-1 {
// we have reach the last flavor, try from the first flavor next time
assignment.TriedFlavorIdx = -1
} else {
assignment.TriedFlavorIdx = assignedFlavorIdx
assignment.TriedFlavorIdx = attemptedFlavorIdx
}
}
if bestAssignmentMode == Fit {
Expand Down
Loading