Skip to content

Commit

Permalink
do not cancel workloads when app pre-eval checks fail
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Nov 17, 2022
1 parent 9b9fbb3 commit 71a9cbc
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions operator/controllers/keptnworkloadinstance/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ func (r *KeptnWorkloadInstanceReconciler) Reconcile(ctx context.Context, req ctr
appPreEvalStatus := appVersion.Status.PreDeploymentEvaluationStatus
if !appPreEvalStatus.IsSucceeded() {
if appPreEvalStatus.IsFailed() {
//cancel everything, as app pre-eval tasks have failed
if err := r.cancelWorkloadInstanceActions(ctx, workloadInstance, phase); err != nil {
span.SetStatus(codes.Error, err.Error())
return ctrl.Result{Requeue: true}, err
}
controllercommon.RecordEvent(r.Recorder, phase, "Warning", workloadInstance, "Failed", "has failed since app has failed", workloadInstance.GetVersion())
return ctrl.Result{Requeue: true, RequeueAfter: 20 * time.Second}, nil
}
Expand Down Expand Up @@ -320,9 +315,3 @@ func getLatestAppVersion(apps *klcv1alpha1.KeptnAppVersionList, wli *klcv1alpha1
}
return workloadFound, latestVersion, nil
}

func (r *KeptnWorkloadInstanceReconciler) cancelWorkloadInstanceActions(ctx context.Context, workloadInstance *klcv1alpha1.KeptnWorkloadInstance, phase common.KeptnPhaseType) error {
workloadInstance.CancelRemainingPhases(phase)
workloadInstance.Complete()
return r.Client.Status().Update(ctx, workloadInstance)
}

0 comments on commit 71a9cbc

Please sign in to comment.