Skip to content

Commit

Permalink
Update SortFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
severinson committed Feb 28, 2024
1 parent baabba5 commit acead16
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/scheduler/schedulerobjects/nodetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ func NewNodeType(taints []v1.Taint, labels map[string]string, indexedTaints map[

// Sort taints to ensure node type id is consistent regardless of
// the order in which taints are set on the node.
slices.SortFunc(taints, func(a, b v1.Taint) bool { return a.Key < b.Key }) // TODO: Use less ambiguous sorting.
slices.SortFunc(taints, func(a, b v1.Taint) int {
if a.Key < b.Key {
return -1
} else if a.Key > b.Key {
return 1
} else {
return 0
}
}) // TODO: Use less ambiguous sorting.

// Filter out any labels that should not be indexed.
if indexedLabels != nil {
Expand Down

0 comments on commit acead16

Please sign in to comment.