Consider pending pods to be a validation failure

Also log the names of the non-ready containers.
This commit is contained in:
Justin Santa Barbara 2018-09-16 19:47:23 -04:00 committed by Justin SB
parent ede358c19b
commit f49aba4147
No known key found for this signature in database
GPG Key ID: 8DEC5C8217494E37
2 changed files with 21 additions and 8 deletions

View File

@ -187,7 +187,6 @@ func validateClusterOutputTable(result *validation.ValidationCluster, cluster *a
fmt.Fprintln(out, "INSTANCE GROUPS") fmt.Fprintln(out, "INSTANCE GROUPS")
err := t.Render(instanceGroups, out, "NAME", "ROLE", "MACHINETYPE", "MIN", "MAX", "SUBNETS") err := t.Render(instanceGroups, out, "NAME", "ROLE", "MACHINETYPE", "MIN", "MAX", "SUBNETS")
if err != nil { if err != nil {
return fmt.Errorf("cannot render nodes for %q: %v", cluster.Name, err) return fmt.Errorf("cannot render nodes for %q: %v", cluster.Name, err)
} }

View File

@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"net" "net"
"net/url" "net/url"
"strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
@ -185,15 +186,28 @@ func (v *ValidationCluster) collectPodFailures(client kubernetes.Interface) erro
if pod.Status.Phase == v1.PodSucceeded { if pod.Status.Phase == v1.PodSucceeded {
continue continue
} }
for _, status := range pod.Status.ContainerStatuses { if pod.Status.Phase == v1.PodPending {
if !status.Ready { v.addError(&ValidationError{
v.addError(&ValidationError{ Kind: "Pod",
Kind: "Pod", Name: "kube-system/" + pod.Name,
Name: "kube-system/" + pod.Name, Message: fmt.Sprintf("kube-system pod %q is pending", pod.Name),
Message: fmt.Sprintf("kube-system pod %q is not healthy", pod.Name), })
}) continue
}
var notready []string
for _, container := range pod.Status.ContainerStatuses {
if !container.Ready {
notready = append(notready, container.Name)
} }
} }
if len(notready) != 0 {
v.addError(&ValidationError{
Kind: "Pod",
Name: "kube-system/" + pod.Name,
Message: fmt.Sprintf("kube-system pod %q is not ready (%s)", pod.Name, strings.Join(notready, ",")),
})
}
} }
return nil return nil
} }