Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2456 from ibuildthecloud/main
Browse files Browse the repository at this point in the history
Handle unknown and evicted pods
  • Loading branch information
ibuildthecloud authored Jan 23, 2024
2 parents 95dfdfb + 6e9cb0d commit 5010053
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/controller/local/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,23 @@ func DeletePods(req router.Request, resp router.Response) error {
return req.Client.Delete(req.Ctx, pod)
}
}

if pod.Status.Phase == corev1.PodRunning && len(pod.Status.ContainerStatuses) > 0 {
allUnknown := true
for _, status := range pod.Status.ContainerStatuses {
if status.State.Terminated == nil || status.State.Terminated.Reason != "Unknown" {
allUnknown = false
break
}
}
if allUnknown {
return req.Client.Delete(req.Ctx, pod)
}
}

if pod.Status.Reason == "Evicted" {
return req.Client.Delete(req.Ctx, pod)
}

return nil
}

0 comments on commit 5010053

Please sign in to comment.