Catch the case where we cannot find any nodes.

It's possible to fall through the loops above with node still nil.  This
catches this and reports an error.

Found this working on #27819.
This commit is contained in:
Matt Liggett 2016-06-22 11:44:45 -07:00
parent 4e2433cfab
commit d6ab379275

View File

@ -659,6 +659,10 @@ func (kd *KubeDNS) getClusterZone() (string, error) {
}
}
if node == nil {
return "", fmt.Errorf("Could not find any nodes")
}
zone, ok := node.Annotations[unversioned.LabelZoneFailureDomain]
if !ok || zone == "" {
return "", fmt.Errorf("unknown cluster zone")