From 31b79f481e0d59ba46af734cc7269a8cfab941d2 Mon Sep 17 00:00:00 2001 From: "Jerry.Ge" Date: Thu, 11 Mar 2021 22:04:29 -0500 Subject: [PATCH] added eventsToRegister for nodeName & nodeUnschedulable plugins Signed-off-by: Jerry Ge --- pkg/scheduler/framework/plugins/nodename/node_name.go | 9 +++++++++ .../plugins/nodeunschedulable/node_unschedulable.go | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pkg/scheduler/framework/plugins/nodename/node_name.go b/pkg/scheduler/framework/plugins/nodename/node_name.go index 070170360ed..ff0d916cde5 100644 --- a/pkg/scheduler/framework/plugins/nodename/node_name.go +++ b/pkg/scheduler/framework/plugins/nodename/node_name.go @@ -28,6 +28,7 @@ import ( type NodeName struct{} var _ framework.FilterPlugin = &NodeName{} +var _ framework.EnqueueExtensions = &NodeName{} const ( // Name is the name of the plugin used in the plugin registry and configurations. @@ -37,6 +38,14 @@ const ( ErrReason = "node(s) didn't match the requested node name" ) +// EventsToRegister returns the possible events that may make a Pod +// failed by this plugin schedulable. +func (pl *NodeName) EventsToRegister() []framework.ClusterEvent { + return []framework.ClusterEvent{ + {Resource: framework.Node, ActionType: framework.Add}, + } +} + // Name returns name of the plugin. It is used in logs, etc. func (pl *NodeName) Name() string { return Name diff --git a/pkg/scheduler/framework/plugins/nodeunschedulable/node_unschedulable.go b/pkg/scheduler/framework/plugins/nodeunschedulable/node_unschedulable.go index 6f128d6ab06..89d3ae2e7c6 100644 --- a/pkg/scheduler/framework/plugins/nodeunschedulable/node_unschedulable.go +++ b/pkg/scheduler/framework/plugins/nodeunschedulable/node_unschedulable.go @@ -31,6 +31,7 @@ type NodeUnschedulable struct { } var _ framework.FilterPlugin = &NodeUnschedulable{} +var _ framework.EnqueueExtensions = &NodeUnschedulable{} // Name is the name of the plugin used in the plugin registry and configurations. const Name = "NodeUnschedulable" @@ -42,6 +43,14 @@ const ( ErrReasonUnschedulable = "node(s) were unschedulable" ) +// EventsToRegister returns the possible events that may make a Pod +// failed by this plugin schedulable. +func (pl *NodeUnschedulable) EventsToRegister() []framework.ClusterEvent { + return []framework.ClusterEvent{ + {Resource: framework.Node, ActionType: framework.Add | framework.UpdateNodeTaint}, + } +} + // Name returns name of the plugin. It is used in logs, etc. func (pl *NodeUnschedulable) Name() string { return Name