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 #592

Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy committed Oct 4, 2023
1 parent 1f701a0 commit 45a8173
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1969,19 +1969,20 @@ 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 bounded.
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
}, ctx.Done())

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

}
return nil
}

Expand Down

0 comments on commit 45a8173

Please sign in to comment.