Remove CSINode from scheduler cache.

This commit is contained in:
Abdullah Gharaibeh
2019-10-16 16:40:55 -04:00
parent aab740ffc2
commit a772722660
12 changed files with 50 additions and 163 deletions

View File

@@ -63,7 +63,7 @@ func NewDefaultRegistry(args *RegistryArgs) framework.Registry {
},
volumerestrictions.Name: volumerestrictions.New,
volumezone.Name: volumezone.New,
nodevolumelimits.Name: nodevolumelimits.New(args.SchedulerCache),
nodevolumelimits.Name: nodevolumelimits.New,
interpodaffinity.Name: func(_ *runtime.Unknown, _ framework.FrameworkHandle) (framework.Plugin, error) {
return interpodaffinity.New(args.SchedulerCache, args.SchedulerCache), nil
},

View File

@@ -49,21 +49,23 @@ func (pl *NodeVolumeLimits) Filter(ctx context.Context, _ *framework.CycleState,
return migration.PredicateResultToFrameworkStatus(reasons, err)
}
// New returns function that initializes a new plugin and returns it.
func New(csiNodeInfo predicates.CSINodeInfo) framework.PluginFactory {
return func(_ *runtime.Unknown, handle framework.FrameworkHandle) (framework.Plugin, error) {
informerFactory := handle.SharedInformerFactory()
pvInfo := &predicates.CachedPersistentVolumeInfo{
PersistentVolumeLister: informerFactory.Core().V1().PersistentVolumes().Lister(),
}
pvcInfo := &predicates.CachedPersistentVolumeClaimInfo{
PersistentVolumeClaimLister: informerFactory.Core().V1().PersistentVolumeClaims().Lister(),
}
classInfo := &predicates.CachedStorageClassInfo{
StorageClassLister: informerFactory.Storage().V1().StorageClasses().Lister(),
}
return &NodeVolumeLimits{
predicate: predicates.NewCSIMaxVolumeLimitPredicate(csiNodeInfo, pvInfo, pvcInfo, classInfo),
}, nil
// New initializes a new plugin and returns it.
func New(_ *runtime.Unknown, handle framework.FrameworkHandle) (framework.Plugin, error) {
informerFactory := handle.SharedInformerFactory()
csiNodeInfo := &predicates.CachedCSINodeInfo{
CSINodeLister: informerFactory.Storage().V1beta1().CSINodes().Lister(),
}
pvInfo := &predicates.CachedPersistentVolumeInfo{
PersistentVolumeLister: informerFactory.Core().V1().PersistentVolumes().Lister(),
}
pvcInfo := &predicates.CachedPersistentVolumeClaimInfo{
PersistentVolumeClaimLister: informerFactory.Core().V1().PersistentVolumeClaims().Lister(),
}
classInfo := &predicates.CachedStorageClassInfo{
StorageClassLister: informerFactory.Storage().V1().StorageClasses().Lister(),
}
return &NodeVolumeLimits{
predicate: predicates.NewCSIMaxVolumeLimitPredicate(csiNodeInfo, pvInfo, pvcInfo, classInfo),
}, nil
}