Skip to content

Commit

Permalink
update to watcher: failing pod always in case of exitCode=2
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-gacesa committed Oct 20, 2021
1 parent a8dcb28 commit 83138d9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions engine/podwatcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,21 @@ func (pw *PodWatcher) updateContainers(containers []containerInfo) {
// Terminated.ExitCode=2 and Terminated.Reason="Error".
// Often container the current image will revert back to the placeholder image.
// Kubernetes is probably downloading an image for the container in the background.
if cs.state == stateTerminated && cs.exitCode == 2 && cs.reason == "Error" {
if cs.exitCode == 2 && cs.reason == "Error" {
if cs.restartCount == 0 {
continue
}

recoveryDuration := time.Minute

if c.failedAt.IsZero() {
logrus.
WithField("pod", pw.podName).
WithField("container", c.id).
WithFields(cs.stateToMap()).
Trace("PodWatcher: Container failed. Trying recovery...")
c.failedAt = time.Now()
} else if time.Since(c.failedAt) < time.Minute {
} else if time.Since(c.failedAt) < recoveryDuration {
logrus.
WithField("pod", pw.podName).
WithField("container", c.id).
Expand Down

0 comments on commit 83138d9

Please sign in to comment.