From 6d789ee640dbd2f2f355bd6ccccdeea74f573805 Mon Sep 17 00:00:00 2001 From: Maciej Borsz Date: Mon, 7 Aug 2017 11:45:09 +0200 Subject: [PATCH] Fix storage tests for multizone test configuration. --- test/e2e/framework/volume_util.go | 9 +++++++-- test/e2e/storage/volumes.go | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/e2e/framework/volume_util.go b/test/e2e/framework/volume_util.go index 14efbbb4672..0a65928fafc 100644 --- a/test/e2e/framework/volume_util.go +++ b/test/e2e/framework/volume_util.go @@ -100,6 +100,8 @@ type VolumeTestConfig struct { ServerNodeName string // ClientNodeName is the spec.nodeName to run client pod on. Default is any node. ClientNodeName string + // NodeSelector to use in pod spec (server, client and injector pods). + NodeSelector map[string]string } // VolumeTest contains a volume to mount into a client pod and its @@ -286,6 +288,7 @@ func StartVolumeServer(client clientset.Interface, config VolumeTestConfig) *v1. Volumes: volumes, RestartPolicy: restartPolicy, NodeName: config.ServerNodeName, + NodeSelector: config.NodeSelector, }, } @@ -390,8 +393,9 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro Level: "s0:c0,c1", }, }, - Volumes: []v1.Volume{}, - NodeName: config.ClientNodeName, + Volumes: []v1.Volume{}, + NodeName: config.ClientNodeName, + NodeSelector: config.NodeSelector, }, } podsNamespacer := client.CoreV1().Pods(config.Namespace) @@ -476,6 +480,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V VolumeSource: volume, }, }, + NodeSelector: config.NodeSelector, }, } diff --git a/test/e2e/storage/volumes.go b/test/e2e/storage/volumes.go index 0fe7287dacb..f5c91a583f5 100644 --- a/test/e2e/storage/volumes.go +++ b/test/e2e/storage/volumes.go @@ -54,6 +54,7 @@ import ( "k8s.io/apimachinery/pkg/types" clientset "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere" + kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" "k8s.io/kubernetes/test/e2e/framework" ) @@ -429,6 +430,11 @@ var _ = SIGDescribe("Volumes", func() { config = framework.VolumeTestConfig{ Namespace: namespace.Name, Prefix: "pd", + // PD will be created in framework.TestContext.CloudConfig.Zone zone, + // so pods should be also scheduled there. + NodeSelector: map[string]string{ + kubeletapis.LabelZoneFailureDomain: framework.TestContext.CloudConfig.Zone, + }, } })