Skip to content

Commit

Permalink
reap evicted pods (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
eytan-avisror committed Jul 23, 2020
1 parent 4a20228 commit 9d02bed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pkg/reaper/podreaper/podreaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ func (ctx *ReaperContext) deriveFailedPods() {
}
}

// include pods which have no containerstatuses, such as evicted pods
if len(times) == 0 {
log.Infof("%v/%v is reapable !! pod in failed state for unknown diff: ??/%v", podNamespace, podName, ctx.ReapFailedAfter)
ctx.FailedPods[podName] = podNamespace
continue
}

Expand Down
14 changes: 11 additions & 3 deletions pkg/reaper/podreaper/podreaper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ func TestReapCompletedFailedDisable(t *testing.T) {
getContainerStatus("container-2", PodFailedReason, time.Now().Add(time.Duration(-80)*time.Minute)),
},
},
{
phase: v1.PodFailed,
containers: []v1.ContainerStatus{},
},
},
FakeReaper: reaper,
ExpectedCompleted: 0,
Expand Down Expand Up @@ -439,11 +443,15 @@ func TestReapFailedPositive(t *testing.T) {
getContainerStatus("container-2", PodFailedReason, time.Now().Add(time.Duration(-10)*time.Minute)),
},
},
{
phase: v1.PodFailed,
containers: []v1.ContainerStatus{},
},
},
FakeReaper: reaper,
ExpectedFailed: 1,
ExpectedReapable: 1,
ExpectedReaped: 1,
ExpectedFailed: 2,
ExpectedReapable: 2,
ExpectedReaped: 2,
}
testCase.Run(t, false)
}
Expand Down

0 comments on commit 9d02bed

Please sign in to comment.