Skip to content

Commit

Permalink
fix(controller): Allow retry on transient errors when validating work…
Browse files Browse the repository at this point in the history
…flow spec. Fixes #6163

Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
  • Loading branch information
terrytangyuan committed Jun 18, 2021
1 parent 4f847e0 commit cffd50a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/utils/pointer"
Expand Down Expand Up @@ -3215,7 +3216,16 @@ func (woc *wfOperationCtx) setExecWorkflow(ctx context.Context) error {
cwftmplGetter := templateresolution.WrapClusterWorkflowTemplateInterface(woc.controller.wfclientset.ArgoprojV1alpha1().ClusterWorkflowTemplates())

// Validate the execution wfSpec
wfConditions, err := validate.ValidateWorkflow(wftmplGetter, cwftmplGetter, woc.wf, validateOpts)
var wfConditions *wfv1.Conditions
err := wait.ExponentialBackoff(retry.DefaultRetry,
func() (bool, error) {
var validationErr error
wfConditions, validationErr = validate.ValidateWorkflow(wftmplGetter, cwftmplGetter, woc.wf, validateOpts)
if validationErr != nil {
return !errorsutil.IsTransientErr(validationErr), validationErr
}
return true, nil
})
if err != nil {
msg := fmt.Sprintf("invalid spec: %s", err.Error())
woc.markWorkflowFailed(ctx, msg)
Expand Down

0 comments on commit cffd50a

Please sign in to comment.