Skip to content

Commit

Permalink
add jobs exceptions to pod validation
Browse files Browse the repository at this point in the history
  • Loading branch information
maorfr committed Nov 20, 2018
1 parent 480e201 commit a27abca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/utils/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,29 @@ func validatePods(name, kubeContext string, envValid bool) (bool, error) {
return envValid, err
}

log.Println("validating that all pods are in \"Running\" phase")
log.Println("validating that all pods are in a valid phase")
for _, pod := range pods.Items {
phase := pod.Status.Phase
if phase == "Running" {
continue
}
if phase == "Succeeded" && pod.OwnerReferences[0].Kind == "Job" {
continue
}
log.Printf("pod %s is in phase \"%s\"", pod.Name, phase)
envValid = false
}

log.Println("validating that all containers are in \"Ready\" status")
log.Println("validating that all containers are ready")
for _, pod := range pods.Items {
statuses := pod.Status.ContainerStatuses
for _, status := range statuses {
if status.Ready {
continue
}
if pod.OwnerReferences[0].Kind == "Job" {
continue
}
log.Printf("container %s/%s is not in \"Ready\" status", pod.Name, status.Name)
envValid = false
}
Expand Down

0 comments on commit a27abca

Please sign in to comment.