From 7437f42963419e8d84b6da32f780b8be7a120ee0 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Mon, 14 Dec 2020 16:27:07 -0500 Subject: [PATCH] fix(executor): Always check if resource has been deleted in checkResourceState() (#4738) Signed-off-by: terrytangyuan terrytangyuan@gmail.com Co-authored-by: merlintang tangrock@gmail.com --- workflow/executor/resource.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workflow/executor/resource.go b/workflow/executor/resource.go index 8b4d35228e40..f39b88c6d761 100644 --- a/workflow/executor/resource.go +++ b/workflow/executor/resource.go @@ -227,6 +227,10 @@ func checkResourceState(resourceNamespace string, resourceName string, successRe }() for { + if checkIfResourceDeleted(resourceName, resourceNamespace) { + return false, errors.Errorf(errors.CodeNotFound, "Resource %s in namespace %s has been deleted somehow.", resourceName, resourceNamespace) + } + jsonBytes, err := readJSON(reader) if err != nil { @@ -254,10 +258,6 @@ func checkResourceState(resourceNamespace string, resourceName string, successRe return true, resultErr } - if checkIfResourceDeleted(resourceName, resourceNamespace) { - return false, errors.Errorf(errors.CodeNotFound, "Resource %s in namespace %s has been deleted somehow.", resourceName, resourceNamespace) - } - log.Info(string(jsonBytes)) ls := gjsonLabels{json: jsonBytes} for _, req := range failReqs {