mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #90283 from gaurav1086/scheduler_cleanup_map_deletion
[Scheduler] Improve complexity from O(logN) to O(1)
This commit is contained in:
commit
18b5c4ddbb
@ -110,10 +110,8 @@ func (pl *CSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod *v
|
|||||||
|
|
||||||
attachedVolumeCount := map[string]int{}
|
attachedVolumeCount := map[string]int{}
|
||||||
for volumeUniqueName, volumeLimitKey := range attachedVolumes {
|
for volumeUniqueName, volumeLimitKey := range attachedVolumes {
|
||||||
if _, ok := newVolumes[volumeUniqueName]; ok {
|
|
||||||
// Don't count single volume used in multiple pods more than once
|
// Don't count single volume used in multiple pods more than once
|
||||||
delete(newVolumes, volumeUniqueName)
|
delete(newVolumes, volumeUniqueName)
|
||||||
}
|
|
||||||
attachedVolumeCount[volumeLimitKey]++
|
attachedVolumeCount[volumeLimitKey]++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,10 +244,8 @@ func (pl *nonCSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod
|
|||||||
|
|
||||||
// filter out already-mounted volumes
|
// filter out already-mounted volumes
|
||||||
for k := range existingVolumes {
|
for k := range existingVolumes {
|
||||||
if _, ok := newVolumes[k]; ok {
|
|
||||||
delete(newVolumes, k)
|
delete(newVolumes, k)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
numNewVolumes := len(newVolumes)
|
numNewVolumes := len(newVolumes)
|
||||||
maxAttachLimit := pl.maxVolumeFunc(node)
|
maxAttachLimit := pl.maxVolumeFunc(node)
|
||||||
|
Loading…
Reference in New Issue
Block a user