Merge pull request #83540 from cofyc/fix83343

Fix volume scheduling error handling
This commit is contained in:
Kubernetes Prow Robot 2019-10-07 01:53:09 -07:00 committed by GitHub
commit 9f875de5d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -353,11 +353,7 @@ func (b *volumeBinder) BindPodVolumes(assumedPod *v1.Pod) (err error) {
return b, err
})
if err != nil {
pvcName := ""
if len(claimsToProvision) > 0 {
pvcName = claimsToProvision[0].Name
}
return fmt.Errorf("Failed to bind volumes: provisioning failed for PVC %q: %v", pvcName, err)
return fmt.Errorf("Failed to bind volumes: %v", err)
}
return nil
}
@ -523,7 +519,10 @@ func (b *volumeBinder) checkBindings(pod *v1.Pod, bindings []*bindingInfo, claim
}
selectedNode := pvc.Annotations[pvutil.AnnSelectedNode]
if selectedNode != pod.Spec.NodeName {
return false, fmt.Errorf("selectedNode annotation value %q not set to scheduled node %q", selectedNode, pod.Spec.NodeName)
// If provisioner fails to provision a volume, selectedNode
// annotation will be removed to signal back to the scheduler to
// retry.
return false, fmt.Errorf("provisioning failed for PVC %q", pvc.Name)
}
// If the PVC is bound to a PV, check its node affinity