Skip to content

Commit

Permalink
[workload] Don't deactivate twice
Browse files Browse the repository at this point in the history
  • Loading branch information
trasc committed Oct 4, 2024
1 parent aee16f2 commit f60d1cc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/controller/core/workload_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,13 @@ func (r *WorkloadReconciler) reconcileMaxExecutionTime(ctx context.Context, wl *
return remainingTime, nil
}

wl.Spec.Active = ptr.To(false)
if err := r.client.Update(ctx, wl); err != nil {
return 0, err
if ptr.Deref(wl.Spec.Active, true) {
wl.Spec.Active = ptr.To(false)
if err := r.client.Update(ctx, wl); err != nil {
return 0, err
}
r.recorder.Eventf(wl, corev1.EventTypeWarning, "MaximumExecutionTimeExceeded", "The maximum execution time (%v) exceeded", wl.Spec.MaximumExecutionTime.Duration)
}
r.recorder.Eventf(wl, corev1.EventTypeWarning, "MaximumExecutionTimeExceeded", "The maximum execution time (%v) exceeded", wl.Spec.MaximumExecutionTime.Duration)
return 0, nil
}

Expand Down

0 comments on commit f60d1cc

Please sign in to comment.