From 14091e4043818da692474b65317c561a98874a96 Mon Sep 17 00:00:00 2001 From: Adam Worrall Date: Tue, 18 Jul 2017 09:55:15 -0700 Subject: [PATCH] Tolerate a missing MasterName (for GKE) GKE created clusters don't provide a MasterName, so don't throw a warning and give up when that happens. --- test/e2e/framework/google_compute.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/e2e/framework/google_compute.go b/test/e2e/framework/google_compute.go index f741a04ec0a..19f3cc5b71b 100644 --- a/test/e2e/framework/google_compute.go +++ b/test/e2e/framework/google_compute.go @@ -162,13 +162,16 @@ func lookupClusterImageSources() (string, string, error) { frags := strings.Split(nodeImg, "/") nodeImg = frags[len(frags)-1] - masterName := TestContext.CloudConfig.MasterName - masterImg, err := host2image(masterName) - if err != nil { - return "", "", err + // For GKE clusters, MasterName will not be defined; we just leave masterImg blank. + masterImg := "" + if masterName := TestContext.CloudConfig.MasterName; masterName != "" { + img, err := host2image(masterName) + if err != nil { + return "", "", err + } + frags = strings.Split(img, "/") + masterImg = frags[len(frags)-1] } - frags = strings.Split(masterImg, "/") - masterImg = frags[len(frags)-1] return masterImg, nodeImg, nil }