From cd6bf47a19ca5b68610201ae2548e4864c6b91ef Mon Sep 17 00:00:00 2001 From: tanjing2020 Date: Tue, 9 Mar 2021 17:54:59 +0800 Subject: [PATCH] implement EnqueueExtensions interface in nodeaffinity --- .../framework/plugins/nodeaffinity/node_affinity.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go b/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go index e4ab811409b..7b2318681d3 100644 --- a/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go +++ b/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go @@ -39,6 +39,7 @@ type NodeAffinity struct { var _ framework.FilterPlugin = &NodeAffinity{} var _ framework.ScorePlugin = &NodeAffinity{} +var _ framework.EnqueueExtensions = &NodeAffinity{} const ( // Name is the name of the plugin used in the plugin registry and configurations. @@ -72,6 +73,14 @@ func (s *preFilterState) Clone() framework.StateData { return s } +// EventsToRegister returns the possible events that may make a Pod +// failed by this plugin schedulable. +func (pl *NodeAffinity) EventsToRegister() []framework.ClusterEvent { + return []framework.ClusterEvent{ + {Resource: framework.Node, ActionType: framework.Add | framework.UpdateNodeLabel}, + } +} + // PreFilter builds and writes cycle state used by Filter. func (pl *NodeAffinity) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod) *framework.Status { state := getPodRequiredNodeSelectorAndAffinity(pod)