Skip to content

Commit a327302

Browse files
committed
e2e tests should be multizone aware
Pass MULTIZONE=true env. variable to e2e test framework.
1 parent 873d0a7 commit a327302

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

hack/ginkgo-e2e.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export PATH=$(dirname "${e2e_test}"):"${PATH}"
133133
--provider="${KUBERNETES_PROVIDER}" \
134134
--gce-project="${PROJECT:-}" \
135135
--gce-zone="${ZONE:-}" \
136+
--gce-multizone="${MULTIZONE:-false}" \
136137
--gke-cluster="${CLUSTER_NAME:-}" \
137138
--kube-master="${KUBE_MASTER:-}" \
138139
--cluster-tag="${CLUSTER_ID:-}" \

hack/verify-flags/known-flags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ garbage-collector-enabled
281281
gather-logs-sizes
282282
gather-metrics-at-teardown
283283
gather-resource-usage
284+
gce-multizone
284285
gce-project
285286
gce-service-account
286287
gce-upgrade-script

test/e2e/e2e.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ func setupProviderConfig() error {
7272
if err != nil {
7373
return fmt.Errorf("error parsing GCE/GKE region from zone %q: %v", zone, err)
7474
}
75-
managedZones := []string{zone} // Only single-zone for now
75+
managedZones := []string{} // Manage all zones in the region
76+
if !framework.TestContext.CloudConfig.MultiZone {
77+
managedZones = []string{zone}
78+
}
7679
cloudConfig.Provider, err = gcecloud.CreateGCECloud(framework.TestContext.CloudConfig.ProjectID, region, zone, managedZones, "" /* networkUrl */, nil /* nodeTags */, "" /* nodeInstancePerfix */, nil /* tokenSource */, false /* useMetadataServer */)
7780
if err != nil {
7881
return fmt.Errorf("Error building GCE/GKE provider: %v", err)

test/e2e/framework/test_context.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ type NodeTestContextType struct {
129129
type CloudConfig struct {
130130
ProjectID string
131131
Zone string
132+
MultiZone bool
132133
Cluster string
133134
MasterName string
134135
NodeInstanceGroup string
@@ -194,6 +195,7 @@ func RegisterClusterFlags() {
194195
flag.StringVar(&cloudConfig.MasterName, "kube-master", "", "Name of the kubernetes master. Only required if provider is gce or gke")
195196
flag.StringVar(&cloudConfig.ProjectID, "gce-project", "", "The GCE project being used, if applicable")
196197
flag.StringVar(&cloudConfig.Zone, "gce-zone", "", "GCE zone being used, if applicable")
198+
flag.BoolVar(&cloudConfig.MultiZone, "gce-multizone", false, "If true, start GCE cloud provider with multizone support.")
197199
flag.StringVar(&cloudConfig.Cluster, "gke-cluster", "", "GKE name of cluster being used, if applicable")
198200
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.")
199201
flag.StringVar(&cloudConfig.Network, "network", "e2e", "The cloud provider network for this e2e cluster.")

0 commit comments

Comments
 (0)