Merge pull request #100026 from minbaev/enqueue-extions-to-nvl

add enqueue-extensions nodevolumelimits plugin
This commit is contained in:
Kubernetes Prow Robot 2021-05-24 21:48:20 -07:00 committed by GitHub
commit 5cdf7a714f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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.