From 77485456a3b1c0ed2c1298ef176eceedf400ebd3 Mon Sep 17 00:00:00 2001 From: Mike Mayo Date: Mon, 17 Jul 2023 17:37:15 -0400 Subject: [PATCH] set default timeout, if one has not been set to this point Signed-off-by: Mike Mayo --- pkg/kube/wait.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/kube/wait.go b/pkg/kube/wait.go index ecdd38940..491a212a5 100644 --- a/pkg/kube/wait.go +++ b/pkg/kube/wait.go @@ -47,6 +47,11 @@ type waiter struct { func (w *waiter) waitForResources(created ResourceList) error { w.log("beginning wait for %d resources with timeout of %v", len(created), w.timeout) + // Set a default timeout of 5 minutes + if w.timeout == 0 { + w.timeout = time.Minute * 5 + } + ctx, cancel := context.WithTimeout(context.Background(), w.timeout) defer cancel() @@ -65,6 +70,11 @@ func (w *waiter) waitForResources(created ResourceList) error { func (w *waiter) waitForDeletedResources(deleted ResourceList) error { w.log("beginning wait for %d resources to be deleted with timeout of %v", len(deleted), w.timeout) + // Set a default timeout of 5 minutes + if w.timeout == 0 { + w.timeout = time.Minute * 5 + } + ctx, cancel := context.WithTimeout(context.Background(), w.timeout) defer cancel()