add PreEvictionFilter extension to DefaultEvictor Plugin

This commit is contained in:
Lucas Severo Alves
2022-09-20 17:29:41 +02:00
parent 15045c5dcb
commit edec8fe010
14 changed files with 406 additions and 246 deletions
@@ -54,8 +54,9 @@ func New(args runtime.Object, handle framework.Handle) (framework.Plugin, error)
excludedNamespaces = sets.NewString(nodeAffinityArgs.Namespaces.Exclude...)
}
// We can combine Filter and PreEvictionFilter since for this strategy it does not matter where we run PreEvictionFilter
podFilter, err := podutil.NewOptions().
WithFilter(handle.Evictor().Filter).
WithFilter(podutil.WrapFilterFuncs(handle.Evictor().Filter, handle.Evictor().PreEvictionFilter)).
WithNamespaces(includedNamespaces).
WithoutNamespaces(excludedNamespaces).
WithLabelSelector(nodeAffinityArgs.LabelSelector).