mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-19 15:56:54 +00:00
[Backport release-1.2] Fix: handle workflow cache reconcile (#3148)
* Fix: handle workflow cache reconcile Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> (cherry picked from commit12df87ac11) * fix return and move backoff to memory Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> (cherry picked from commitee876f53c3) * handle failed to patch case Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> (cherry picked from commiteac4a1b370) * add store in err case Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> (cherry picked from commit32825c5c41) * make reviewable Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> (cherry picked from commit02b9c60922) * fix ut Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> (cherry picked from commitbff156cbe6) * do cleanup in ut Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> (cherry picked from commit463bd96e78) Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
committed by
GitHub
parent
8cf2f20846
commit
ee8773e1cf
@@ -245,6 +245,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
if status := app.Status.Workflow; status != nil && status.Terminated {
|
||||
return r.result(nil).ret()
|
||||
}
|
||||
case common.WorkflowStateSkipping:
|
||||
logCtx.Info("Skip this reconcile")
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
var phase = common.ApplicationRunning
|
||||
@@ -389,7 +392,12 @@ func (r *Reconciler) endWithNegativeCondition(ctx context.Context, app *v1beta1.
|
||||
func (r *Reconciler) patchStatus(ctx context.Context, app *v1beta1.Application, phase common.ApplicationPhase) error {
|
||||
app.Status.Phase = phase
|
||||
updateObservedGeneration(app)
|
||||
return r.Status().Patch(ctx, app, client.Merge)
|
||||
if err := r.Status().Patch(ctx, app, client.Merge); err != nil {
|
||||
// set to -1 to re-run workflow if status is failed to patch
|
||||
workflow.StepStatusCache.Store(fmt.Sprintf("%s-%s", app.Name, app.Namespace), -1)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Reconciler) updateStatus(ctx context.Context, app *v1beta1.Application, phase common.ApplicationPhase) error {
|
||||
@@ -403,7 +411,12 @@ func (r *Reconciler) updateStatus(ctx context.Context, app *v1beta1.Application,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return r.Status().Update(ctx, obj)
|
||||
if err := r.Status().Update(ctx, obj); err != nil {
|
||||
// set to -1 to re-run workflow if status is failed to update
|
||||
workflow.StepStatusCache.Store(fmt.Sprintf("%s-%s", app.Name, app.Namespace), -1)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Reconciler) doWorkflowFinish(app *v1beta1.Application, wf workflow.Workflow) error {
|
||||
|
||||
Reference in New Issue
Block a user