Skip to content

Commit 7fab683

Browse files
authored
Merge pull request kubernetes#83343 from yutedz/bind-vol-err
Return proper error message when BindPodVolumes fails
2 parents 7f6d7af + 94d4bf1 commit 7fab683

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/controller/volume/scheduling/scheduler_binder.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,18 @@ func (b *volumeBinder) BindPodVolumes(assumedPod *v1.Pod) (err error) {
348348
return err
349349
}
350350

351-
return wait.Poll(time.Second, b.bindTimeout, func() (bool, error) {
351+
err = wait.Poll(time.Second, b.bindTimeout, func() (bool, error) {
352352
b, err := b.checkBindings(assumedPod, bindings, claimsToProvision)
353353
return b, err
354354
})
355+
if err != nil {
356+
pvcName := ""
357+
if len(claimsToProvision) > 0 {
358+
pvcName = claimsToProvision[0].Name
359+
}
360+
return fmt.Errorf("Failed to bind volumes: provisioning failed for PVC %q: %v", pvcName, err)
361+
}
362+
return nil
355363
}
356364

357365
func getPodName(pod *v1.Pod) string {

0 commit comments

Comments
 (0)