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: Cleanup flavor assigner check #3391

Merged
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
13 changes: 3 additions & 10 deletions pkg/scheduler/flavorassigner/flavorassigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,9 @@ func (a *FlavorAssigner) findFlavorForPodSetResource(
continue
}
if features.Enabled(features.TopologyAwareScheduling) {
// For PodSets which require TAS skip resource flavors which don't support it
if ps.TopologyRequest != nil && flavor.Spec.TopologyName == nil {
log.Error(nil, "Flavor does not support TopologyAwareScheduling", "Flavor", fName)
status.append(fmt.Sprintf("flavor %s does not support TopologyAwareScheduling", fName))
continue
}
// For PodSets which don't use TAS skip resource flavors which are only for TAS
if ps.TopologyRequest == nil && flavor.Spec.TopologyName != nil {
log.Error(nil, "Flavor supports only TopologyAwareScheduling", "Flavor", fName)
status.append(fmt.Sprintf("flavor %s supports only TopologyAwareScheduling", fName))
if message := checkPodSetAndFlavorMatchForTAS(ps, flavor); message != nil {
log.Error(nil, *message)
status.append(*message)
continue
}
}
Expand Down
13 changes: 13 additions & 0 deletions pkg/scheduler/flavorassigner/tas_flavorassigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"

"github.com/go-logr/logr"
"k8s.io/utils/ptr"

kueue "sigs.k8s.io/kueue/apis/kueue/v1beta1"
"sigs.k8s.io/kueue/pkg/cache"
Expand Down Expand Up @@ -90,3 +91,15 @@ func onlyFlavor(ra ResourceAssignment) (*kueue.ResourceFlavorReference, error) {
}
return nil, errors.New("no flavor assigned")
}

func checkPodSetAndFlavorMatchForTAS(ps *kueue.PodSet, flavor *kueue.ResourceFlavor) *string {
// For PodSets which require TAS skip resource flavors which don't support it
if ps.TopologyRequest != nil && flavor.Spec.TopologyName == nil {
return ptr.To(fmt.Sprintf("Flavor %q does not support TopologyAwareScheduling", flavor.Name))
}
// For PodSets which don't use TAS skip resource flavors which are only for TAS
if ps.TopologyRequest == nil && flavor.Spec.TopologyName != nil {
return ptr.To(fmt.Sprintf("Flavor %q supports only TopologyAwareScheduling", flavor.Name))
}
return nil
}