Skip to content

Commit

Permalink
fix(controller): Do not panic of woc.orig in not hydrated. Fixes argo…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed May 28, 2020
1 parent 132b947 commit f64a4a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions workflow/controller/operator.go
Expand Up @@ -543,16 +543,17 @@ func (woc *wfOperationCtx) persistWorkflowSizeLimitErr(wfClient v1alpha1.Workflo
woc.markWorkflowError(err, true)
_, err = wfClient.Update(woc.wf)
if err != nil {
woc.log.Warnf("Error updating workflow: %v", err)
woc.log.Warnf("Error updating workflow with size error: %v", err)
}
}

// reapplyUpdate GETs the latest version of the workflow, re-applies the updates and
// retries the UPDATE multiple times. For reasoning behind this technique, see:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#concurrency-control-and-consistency
func (woc *wfOperationCtx) reapplyUpdate(wfClient v1alpha1.WorkflowInterface, nodes wfv1.Nodes) (*wfv1.Workflow, error) {
if !woc.controller.hydrator.IsHydrated(woc.orig) {
panic("original workflow is not hydrated")
err := woc.controller.hydrator.Hydrate(woc.orig)
if err != nil {
return nil, err
}
// First generate the patch
oldData, err := json.Marshal(woc.orig)
Expand Down

0 comments on commit f64a4a1

Please sign in to comment.