feat(scheduler): use context in the scheduler package

+ Use context instead of stopCh
+ Add context to the scheduling framework interface
This commit is contained in:
draveness
2019-08-28 19:12:02 +08:00
parent f7091992c0
commit 47a6c5b693
42 changed files with 426 additions and 352 deletions

View File

@@ -17,7 +17,9 @@ limitations under the License.
package nodeaffinity
import (
"k8s.io/api/core/v1"
"context"
v1 "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"
@@ -39,7 +41,7 @@ func (pl *NodeAffinity) Name() string {
}
// Filter invoked at the filter extension point.
func (pl *NodeAffinity) Filter(_ *framework.CycleState, pod *v1.Pod, nodeInfo *nodeinfo.NodeInfo) *framework.Status {
func (pl *NodeAffinity) Filter(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, nodeInfo *nodeinfo.NodeInfo) *framework.Status {
_, reasons, err := predicates.PodMatchNodeSelector(pod, nil, nodeInfo)
return migration.PredicateResultToFrameworkStatus(reasons, err)
}