Skip to content

Commit

Permalink
Merge pull request volcano-sh#21 from wackxu/fixmultische
Browse files Browse the repository at this point in the history
fix podInformer FilterFunc bug
  • Loading branch information
volcano-sh-bot authored Jun 3, 2019
2 parents b7a3371 + 8b69136 commit 8eab88e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/scheduler/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package cache

import (
"fmt"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -250,10 +249,12 @@ func newSchedulerCache(config *rest.Config, schedulerName string, defaultQueue s
switch obj.(type) {
case *v1.Pod:
pod := obj.(*v1.Pod)
if strings.Compare(pod.Spec.SchedulerName, schedulerName) == 0 && pod.Status.Phase == v1.PodPending {
return true
if !responsibleForPod(pod, schedulerName) {
if len(pod.Spec.NodeName) == 0 {
return false
}
}
return pod.Status.Phase != v1.PodPending
return true
default:
return false
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/scheduler/cache/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ func createShadowPodGroup(pod *v1.Pod) *v1alpha1.PodGroup {
},
}
}

// responsibleForPod returns true if the pod has asked to be scheduled by the given scheduler.
func responsibleForPod(pod *v1.Pod, schedulerName string) bool {
return schedulerName == pod.Spec.SchedulerName
}

0 comments on commit 8eab88e

Please sign in to comment.