Fix storage tests for multizone test configuration.

pull/6/head
Maciej Borsz 2017-08-07 11:45:09 +02:00
parent bc7ccfe93b
commit 6d789ee640
2 changed files with 13 additions and 2 deletions

View File

@ -100,6 +100,8 @@ type VolumeTestConfig struct {
ServerNodeName string ServerNodeName string
// ClientNodeName is the spec.nodeName to run client pod on. Default is any node. // ClientNodeName is the spec.nodeName to run client pod on. Default is any node.
ClientNodeName string 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 // 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, Volumes: volumes,
RestartPolicy: restartPolicy, RestartPolicy: restartPolicy,
NodeName: config.ServerNodeName, NodeName: config.ServerNodeName,
NodeSelector: config.NodeSelector,
}, },
} }
@ -390,8 +393,9 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro
Level: "s0:c0,c1", Level: "s0:c0,c1",
}, },
}, },
Volumes: []v1.Volume{}, Volumes: []v1.Volume{},
NodeName: config.ClientNodeName, NodeName: config.ClientNodeName,
NodeSelector: config.NodeSelector,
}, },
} }
podsNamespacer := client.CoreV1().Pods(config.Namespace) podsNamespacer := client.CoreV1().Pods(config.Namespace)
@ -476,6 +480,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V
VolumeSource: volume, VolumeSource: volume,
}, },
}, },
NodeSelector: config.NodeSelector,
}, },
} }

View File

@ -54,6 +54,7 @@ import (
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere" "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere"
kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
) )
@ -429,6 +430,11 @@ var _ = SIGDescribe("Volumes", func() {
config = framework.VolumeTestConfig{ config = framework.VolumeTestConfig{
Namespace: namespace.Name, Namespace: namespace.Name,
Prefix: "pd", 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,
},
} }
}) })