From 3b4be144ab782b7055edeb6ab299639343618048 Mon Sep 17 00:00:00 2001 From: Alexander Minbaev Date: Tue, 9 Mar 2021 13:10:45 -0600 Subject: [PATCH] add enqueue-extensions nodevolumelimits plugin --- .../framework/plugins/nodevolumelimits/csi.go | 10 ++++++++++ .../framework/plugins/nodevolumelimits/non_csi.go | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go b/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go index 204f022f63a..1f3fd2efeaa 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go @@ -57,6 +57,7 @@ type CSILimits struct { } var _ framework.FilterPlugin = &CSILimits{} +var _ framework.EnqueueExtensions = &CSILimits{} // CSIName is the name of the plugin used in the plugin registry and configurations. const CSIName = "NodeVolumeLimits" @@ -66,6 +67,15 @@ func (pl *CSILimits) Name() string { return CSIName } +// EventsToRegister returns the possible events that may make a Pod +// failed by this plugin schedulable. +func (pl *CSILimits) EventsToRegister() []framework.ClusterEvent { + return []framework.ClusterEvent{ + {Resource: framework.CSINode, ActionType: framework.Add}, + {Resource: framework.Pod, ActionType: framework.Delete}, + } +} + // Filter invoked at the filter extension point. func (pl *CSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status { // If the new pod doesn't have any volume attached to it, the predicate will always be true diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go b/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go index 1b89efa389a..ff3f620a6c9 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go @@ -119,6 +119,7 @@ type nonCSILimits struct { } var _ framework.FilterPlugin = &nonCSILimits{} +var _ framework.EnqueueExtensions = &nonCSILimits{} // newNonCSILimitsWithInformerFactory returns a plugin with filter name and informer factory. func newNonCSILimitsWithInformerFactory( @@ -195,6 +196,15 @@ func (pl *nonCSILimits) Name() string { return pl.name } +// EventsToRegister returns the possible events that may make a Pod +// failed by this plugin schedulable. +func (pl *nonCSILimits) EventsToRegister() []framework.ClusterEvent { + return []framework.ClusterEvent{ + {Resource: framework.Node, ActionType: framework.Add}, + {Resource: framework.Pod, ActionType: framework.Delete}, + } +} + // Filter invoked at the filter extension point. func (pl *nonCSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status { // If a pod doesn't have any volume attached to it, the predicate will always be true.