Commit eb59bc60 authored by Bobby (Babak) Salamat's avatar Bobby (Babak) Salamat

Short circuit volume checker if the pod is not requesting any volumes

parent 30566b99
......@@ -1642,7 +1642,21 @@ func NewVolumeBindingPredicate(binder *volumebinder.VolumeBinder) FitPredicate {
return c.predicate
}
func podHasPVCs(pod *v1.Pod) bool {
for _, vol := range pod.Spec.Volumes {
if vol.PersistentVolumeClaim != nil {
return true
}
}
return false
}
func (c *VolumeBindingChecker) predicate(pod *v1.Pod, meta PredicateMetadata, nodeInfo *schedulernodeinfo.NodeInfo) (bool, []PredicateFailureReason, error) {
// If pod does not request any PVC, we don't need to do anything.
if !podHasPVCs(pod) {
return true, nil, nil
}
node := nodeInfo.Node()
if node == nil {
return false, nil, fmt.Errorf("node not found")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment