Merge pull request #90283 from gaurav1086/scheduler_cleanup_map_deletion

[Scheduler] Improve complexity from O(logN) to O(1)
This commit is contained in:
Kubernetes Prow Robot
2020-04-20 10:41:53 -07:00
committed by GitHub
2 changed files with 3 additions and 7 deletions

View File

@@ -110,10 +110,8 @@ func (pl *CSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod *v
attachedVolumeCount := map[string]int{}
for volumeUniqueName, volumeLimitKey := range attachedVolumes {
if _, ok := newVolumes[volumeUniqueName]; ok {
// Don't count single volume used in multiple pods more than once
delete(newVolumes, volumeUniqueName)
}
attachedVolumeCount[volumeLimitKey]++
}

View File

@@ -244,10 +244,8 @@ func (pl *nonCSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod
// filter out already-mounted volumes
for k := range existingVolumes {
if _, ok := newVolumes[k]; ok {
delete(newVolumes, k)
}
}
numNewVolumes := len(newVolumes)
maxAttachLimit := pl.maxVolumeFunc(node)