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

Commit

Permalink
Merge pull request #3 from thousandeyes/main
Browse files Browse the repository at this point in the history
Skip pods with errored containers
  • Loading branch information
tolleiv authored May 16, 2024
2 parents 45a0ea8 + 9410e1a commit 1ca2002
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (c *Controller) checkContainerStatus(key string) error {

activeCount := 0
terminatedCount := 0
errorCount := 0
for _, containerStatus := range obj.(*v1.Pod).Status.ContainerStatuses {
if strings.HasPrefix(containerStatus.Name, "istio-") {
continue
Expand All @@ -74,10 +75,13 @@ func (c *Controller) checkContainerStatus(key string) error {
}
if containerStatus.State.Terminated != nil {
terminatedCount = terminatedCount + 1
if containerStatus.State.Terminated.Reason == "Error" && obj.(*v1.Pod).Spec.RestartPolicy != "Never" {
errorCount = errorCount + 1
}
}
}

if activeCount != 0 || terminatedCount == 0 {
if activeCount != 0 || terminatedCount == 0 || errorCount != 0 {
return nil
}

Expand Down

0 comments on commit 1ca2002

Please sign in to comment.