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
commit 18b5c4ddbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
}
// Don't count single volume used in multiple pods more than once
delete(newVolumes, volumeUniqueName)
attachedVolumeCount[volumeLimitKey]++
}

View File

@ -244,9 +244,7 @@ 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)
}
delete(newVolumes, k)
}
numNewVolumes := len(newVolumes)