Skip to content

Commit

Permalink
Change PVC bining pooling to match v2.5.1 wait version
Browse files Browse the repository at this point in the history
for backport kubev2v#592

Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy committed Oct 4, 2023
1 parent 1f701a0 commit 94a337b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1969,18 +1969,22 @@ func (r *KubeVirt) CreatePvcForNfs(pvcName string) (err error) {
Name: pvcName,
}

if err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 45*time.Second, true, func(ctx context.Context) (done bool, err error) {
err = r.Get(context.TODO(), pvcNamespacedName, pvc)
timeout := 45 * time.Second
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()

// wait until pvc and pv are bound.
err = wait.PollImmediateUntil(5*time.Second, func() (bool, error) {
err := r.Get(context.TODO(), pvcNamespacedName, pvc)
if err != nil {
r.Log.Error(err, "Failed to get OVA plan PVC")
return false, err
}
return pvc.Status.Phase == "Bound", nil

}); err != nil {
}, ctx.Done())
if err != nil {
r.Log.Error(err, "Failed to bind OVA PVC to PV ")
return

}
return nil
}
Expand Down

0 comments on commit 94a337b

Please sign in to comment.