@@ -42,12 +42,7 @@ func (pl *VolumeRestrictions) Name() string {
42
42
return Name
43
43
}
44
44
45
- func isVolumeConflict (volume v1.Volume , pod * v1.Pod ) bool {
46
- // fast path if there is no conflict checking targets.
47
- if volume .GCEPersistentDisk == nil && volume .AWSElasticBlockStore == nil && volume .RBD == nil && volume .ISCSI == nil {
48
- return false
49
- }
50
-
45
+ func isVolumeConflict (volume * v1.Volume , pod * v1.Pod ) bool {
51
46
for _ , existingVolume := range pod .Spec .Volumes {
52
47
// Same GCE disk mounted by multiple pods conflicts unless all pods mount it read-only.
53
48
if volume .GCEPersistentDisk != nil && existingVolume .GCEPersistentDisk != nil {
@@ -118,7 +113,13 @@ func haveOverlap(a1, a2 []string) bool {
118
113
// - Ceph RBD forbids if any two pods share at least same monitor, and match pool and image, and the image is read-only
119
114
// - ISCSI forbids if any two pods share at least same IQN and ISCSI volume is read-only
120
115
func (pl * VolumeRestrictions ) Filter (ctx context.Context , _ * framework.CycleState , pod * v1.Pod , nodeInfo * framework.NodeInfo ) * framework.Status {
121
- for _ , v := range pod .Spec .Volumes {
116
+ for i := range pod .Spec .Volumes {
117
+ v := & pod .Spec .Volumes [i ]
118
+ // fast path if there is no conflict checking targets.
119
+ if v .GCEPersistentDisk == nil && v .AWSElasticBlockStore == nil && v .RBD == nil && v .ISCSI == nil {
120
+ continue
121
+ }
122
+
122
123
for _ , ev := range nodeInfo .Pods {
123
124
if isVolumeConflict (v , ev .Pod ) {
124
125
return framework .NewStatus (framework .Unschedulable , ErrReasonDiskConflict )
0 commit comments