Ignore non-available volumes in findMatchingVolume to reduce chance of

unnecessary binding failures.
This commit is contained in:
Yecheng Fu 2018-09-14 19:22:55 +08:00
parent 516876b232
commit b3cb1bdc4a

View File

@ -211,11 +211,18 @@ func findMatchingVolume(
} }
// filter out: // filter out:
// - volumes in non-available phase
// - volumes bound to another claim // - volumes bound to another claim
// - volumes whose labels don't match the claim's selector, if specified // - volumes whose labels don't match the claim's selector, if specified
// - volumes in Class that is not requested // - volumes in Class that is not requested
// - volumes whose NodeAffinity does not match the node // - volumes whose NodeAffinity does not match the node
if volume.Spec.ClaimRef != nil { if volume.Status.Phase != v1.VolumeAvailable {
// We ignore volumes in non-available phase, because volumes that
// satisfies matching criteria will be updated to available, binding
// them now has high chance of encountering unnecessary failures
// due to API conflicts.
continue
} else if volume.Spec.ClaimRef != nil {
continue continue
} else if selector != nil && !selector.Matches(labels.Set(volume.Labels)) { } else if selector != nil && !selector.Matches(labels.Set(volume.Labels)) {
continue continue