Skip to content

Commit

Permalink
Consider not-found pod as permanent when taskrun is done
Browse files Browse the repository at this point in the history
When the taskrun is "done" i.e. it has a completion time set,
we try to stop sidecars. If the pod cannot be found, it has most
likely been evicted and in any case the sidecar is not running
anymore, so we should not return a transient error.

Fixes tektoncd#3517

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
  • Loading branch information
afrittoli committed Nov 19, 2020
1 parent 473e3f3 commit ac501a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/reconciler/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ func (c *Reconciler) stopSidecars(ctx context.Context, tr *v1beta1.TaskRun) (*co
}

if k8serrors.IsNotFound(err) {
// failed to get the pod, return error without any sidecars
return nil, err
// At this stage the TaskRun has been completed if the pod is not found, it won't come back,
// it has probably evicted. We can return the error, but we consider it a permanent one.
return nil, controller.NewPermanentError(err)
} else if err != nil {
logger.Errorf("Error stopping sidecars for TaskRun %q: %v", tr.Name, err)
tr.Status.MarkResourceFailed(podconvert.ReasonFailedResolution, err)
Expand Down

0 comments on commit ac501a4

Please sign in to comment.