Skip to content

Commit

Permalink
clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
ahg-g committed Feb 25, 2022
1 parent 8045f64 commit f82b8cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions pkg/capacity/capacity.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ type Capacity struct {
RequestableResources map[corev1.ResourceName][]FlavorInfo
UsedResources Resources
Workloads map[string]*workload.Info
LabelKeys map[corev1.ResourceName]sets.String
// The set of key labels from all flavors of a resource.
// Those keys define the affinity terms of a workload
// that can be matched against the flavors.
LabelKeys map[corev1.ResourceName]sets.String
}

// FlavorInfo holds processed flavor type.
Expand Down Expand Up @@ -370,7 +373,7 @@ func resourcesByName(in []kueue.Resource) map[corev1.ResourceName][]FlavorInfo {
Taints: append([]corev1.Taint(nil), f.Taints...),
}
if len(f.Labels) != 0 {
fInfo.Labels = map[string]string{}
fInfo.Labels = make(map[string]string, len(f.Labels))
for k, v := range f.Labels {
fInfo.Labels[k] = v
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,9 @@ func (s *Scheduler) assign(ctx context.Context, e *entry) error {
// given that wUsed is the usage of flavors by previous podsets.
// If it finds a flavor, also returns any borrowing required.
func findFlavorForResource(name corev1.ResourceName, val int64, wUsed map[string]int64, cap *capacity.Capacity, spec *corev1.PodSpec) (string, int64) {
// We will only check against the flavors' labels for the resource.
selector := flavorSelector(spec, cap.LabelKeys[name])
for _, flavor := range cap.RequestableResources[name] {
// We will only check against the flavors labels.
selector := flavorSelector(spec, cap.LabelKeys[name])

_, untolerated := corev1helpers.FindMatchingUntoleratedTaint(flavor.Taints, spec.Tolerations, func(t *corev1.Taint) bool {
return t.Effect == corev1.TaintEffectNoSchedule || t.Effect == corev1.TaintEffectNoExecute
})
Expand Down

0 comments on commit f82b8cd

Please sign in to comment.