diff --git a/test/e2e/framework/google_compute.go b/test/e2e/framework/google_compute.go index 1738a55bdd3..cf937b72f5b 100644 --- a/test/e2e/framework/google_compute.go +++ b/test/e2e/framework/google_compute.go @@ -35,8 +35,12 @@ func lookupClusterImageSources() (string, string, error) { gcloudf := func(argv ...string) ([]string, error) { args := []string{"compute"} args = append(args, argv...) - args = append(args, "--project", TestContext.CloudConfig.ProjectID, - "--zone", TestContext.CloudConfig.Zone) + args = append(args, "--project", TestContext.CloudConfig.ProjectID) + if TestContext.CloudConfig.MultiMaster { + args = append(args, "--region", TestContext.CloudConfig.Region) + } else { + args = append(args, "--zone", TestContext.CloudConfig.Zone) + } outputBytes, err := exec.Command("gcloud", args...).CombinedOutput() str := strings.Replace(string(outputBytes), ",", "\n", -1) str = strings.Replace(str, ";", "\n", -1) diff --git a/test/e2e/framework/nodes_util.go b/test/e2e/framework/nodes_util.go index 7185da71ef6..651b5bc244e 100644 --- a/test/e2e/framework/nodes_util.go +++ b/test/e2e/framework/nodes_util.go @@ -120,10 +120,11 @@ func masterUpgradeGCE(rawV string, enableKubeProxyDaemonSet bool) error { } func locationParamGKE() string { - if TestContext.CloudConfig.Zone != "" { - return fmt.Sprintf("--zone=%s", TestContext.CloudConfig.Zone) + if TestContext.CloudConfig.MultiMaster { + // GKE Regional Clusters are being tested. + return fmt.Sprintf("--region=%s", TestContext.CloudConfig.Region) } - return fmt.Sprintf("--region=%s", TestContext.CloudConfig.Region) + return fmt.Sprintf("--zone=%s", TestContext.CloudConfig.Zone) } func appendContainerCommandGroupIfNeeded(args []string) []string { diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 6092eaa9fb7..e5e1fc93ca4 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -161,6 +161,7 @@ type CloudConfig struct { Zone string // for multizone tests, arbitrarily chosen zone Region string MultiZone bool + MultiMaster bool Cluster string MasterName string NodeInstanceGroup string // comma-delimited list of groups' names @@ -245,6 +246,7 @@ func RegisterClusterFlags() { flag.StringVar(&cloudConfig.Zone, "gce-zone", "", "GCE zone being used, if applicable") flag.StringVar(&cloudConfig.Region, "gce-region", "", "GCE region being used, if applicable") flag.BoolVar(&cloudConfig.MultiZone, "gce-multizone", false, "If true, start GCE cloud provider with multizone support.") + flag.BoolVar(&cloudConfig.MultiMaster, "gce-multimaster", false, "If true, the underlying GCE/GKE cluster is assumed to be multi-master.") flag.StringVar(&cloudConfig.Cluster, "gke-cluster", "", "GKE name of cluster being used, if applicable") flag.StringVar(&cloudConfig.NodeInstanceGroup, "node-instance-group", "", "Name of the managed instance group for nodes. Valid only for gce, gke or aws. If there is more than one group: comma separated list of groups.") flag.StringVar(&cloudConfig.Network, "network", "e2e", "The cloud provider network for this e2e cluster.")