|
|
@ -40,24 +40,25 @@ type statusWaiter struct {
|
|
|
|
func (w *statusWaiter) Wait(resourceList ResourceList, timeout time.Duration) error {
|
|
|
|
func (w *statusWaiter) Wait(resourceList ResourceList, timeout time.Duration) error {
|
|
|
|
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
|
|
|
|
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
w.log("beginning wait for %d resources with timeout of %s", len(resourceList), timeout)
|
|
|
|
return w.wait(ctx, resourceList, false)
|
|
|
|
return w.wait(ctx, resourceList, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (w *statusWaiter) WaitWithJobs(resourceList ResourceList, timeout time.Duration) error {
|
|
|
|
func (w *statusWaiter) WaitWithJobs(resourceList ResourceList, timeout time.Duration) error {
|
|
|
|
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
|
|
|
|
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
w.log("beginning wait for %d resources with timeout of %s", len(resourceList), timeout)
|
|
|
|
return w.wait(ctx, resourceList, true)
|
|
|
|
return w.wait(ctx, resourceList, true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (w *statusWaiter) WaitForDelete(resourceList ResourceList, timeout time.Duration) error {
|
|
|
|
func (w *statusWaiter) WaitForDelete(resourceList ResourceList, timeout time.Duration) error {
|
|
|
|
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
|
|
|
|
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
w.log("beginning wait for %d resources to be deleted with timeout of %s", len(resourceList), timeout)
|
|
|
|
return w.waitForDelete(ctx, resourceList)
|
|
|
|
return w.waitForDelete(ctx, resourceList)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (w *statusWaiter) waitForDelete(ctx context.Context, resourceList ResourceList) error {
|
|
|
|
func (w *statusWaiter) waitForDelete(ctx context.Context, resourceList ResourceList) error {
|
|
|
|
deadline, _ := ctx.Deadline()
|
|
|
|
|
|
|
|
w.log("beginning wait for %d resources to be deleted with timeout of %v", len(resourceList), time.Until(deadline))
|
|
|
|
|
|
|
|
cancelCtx, cancel := context.WithCancel(ctx)
|
|
|
|
cancelCtx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
resources := []object.ObjMetadata{}
|
|
|
|
resources := []object.ObjMetadata{}
|
|
|
@ -94,9 +95,7 @@ func (w *statusWaiter) waitForDelete(ctx context.Context, resourceList ResourceL
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (w *statusWaiter) wait(ctx context.Context, resourceList ResourceList, waitForJobs bool) error {
|
|
|
|
func (w *statusWaiter) wait(ctx context.Context, resourceList ResourceList, waitForJobs bool) error {
|
|
|
|
deadline, _ := ctx.Deadline()
|
|
|
|
|
|
|
|
w.log("beginning wait for %d resources with timeout of %v", len(resourceList), deadline)
|
|
|
|
|
|
|
|
cancelCtx, cancel := context.WithCancel(ctx)
|
|
|
|
cancelCtx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
resources := []object.ObjMetadata{}
|
|
|
|
resources := []object.ObjMetadata{}
|
|
|
|