From d6ab37927531f9251c063e3527ba44f07189d933 Mon Sep 17 00:00:00 2001 From: Matt Liggett Date: Wed, 22 Jun 2016 11:44:45 -0700 Subject: [PATCH] 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. --- pkg/dns/dns.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/dns/dns.go b/pkg/dns/dns.go index 4cdfc677155..b65fe9fc55e 100644 --- a/pkg/dns/dns.go +++ b/pkg/dns/dns.go @@ -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")