Change all scheduler's Node and Pod list/lookups to be from the snapshot rather than the cache.

This commit is contained in:
Abdullah Gharaibeh
2019-10-24 18:30:21 -04:00
parent 4ee1e7510f
commit 8ec56aeafb
31 changed files with 243 additions and 101 deletions

View File

@@ -21,10 +21,10 @@ import (
"fmt"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/migration"
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
schedulerlisters "k8s.io/kubernetes/pkg/scheduler/listers"
"k8s.io/kubernetes/pkg/scheduler/nodeinfo"
)
@@ -54,8 +54,8 @@ func (pl *InterPodAffinity) Filter(ctx context.Context, cycleState *framework.Cy
}
// New initializes a new plugin and returns it.
func New(nodeLister schedulerlisters.NodeLister, podLister schedulerlisters.PodLister) framework.Plugin {
func New(_ *runtime.Unknown, h framework.FrameworkHandle) (framework.Plugin, error) {
return &InterPodAffinity{
predicate: predicates.NewPodAffinityPredicate(nodeLister, podLister),
}
predicate: predicates.NewPodAffinityPredicate(h.SnapshotSharedLister().NodeInfos(), h.SnapshotSharedLister().Pods()),
}, nil
}