Merge pull request #27008 from zmerlynn/e2e-routes

Networking e2es: Wait for all nodes to be schedulable in kubeproxy and networking tests
This commit is contained in:
Wojciech Tyczynski 2016-06-08 09:02:30 +02:00
commit 878c8d41f1
3 changed files with 11 additions and 3 deletions

View File

@ -2623,7 +2623,7 @@ func GetReadySchedulableNodesOrDie(c *client.Client) (nodes *api.NodeList) {
} }
func WaitForAllNodesSchedulable(c *client.Client) error { func WaitForAllNodesSchedulable(c *client.Client) error {
return wait.PollImmediate(30*time.Second, 2*time.Hour, func() (bool, error) { return wait.PollImmediate(30*time.Second, 4*time.Hour, func() (bool, error) {
opts := api.ListOptions{ opts := api.ListOptions{
ResourceVersion: "0", ResourceVersion: "0",
FieldSelector: fields.Set{"spec.unschedulable": "false"}.AsSelector(), FieldSelector: fields.Set{"spec.unschedulable": "false"}.AsSelector(),
@ -2634,11 +2634,16 @@ func WaitForAllNodesSchedulable(c *client.Client) error {
// Ignore the error here - it will be retried. // Ignore the error here - it will be retried.
return false, nil return false, nil
} }
schedulable := 0
for _, node := range nodes.Items { for _, node := range nodes.Items {
if !isNodeSchedulable(&node) { if isNodeSchedulable(&node) {
return false, nil schedulable++
} }
} }
if schedulable != len(nodes.Items) {
Logf("%d/%d nodes schedulable (polling after 30s)", schedulable, len(nodes.Items))
return false, nil
}
return true, nil return true, nil
}) })
} }

View File

@ -463,6 +463,7 @@ func (config *KubeProxyTestConfig) setup() {
} }
By("Getting node addresses") By("Getting node addresses")
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(config.f.Client))
nodeList := framework.GetReadySchedulableNodesOrDie(config.f.Client) nodeList := framework.GetReadySchedulableNodesOrDie(config.f.Client)
config.externalAddrs = framework.NodeAddresses(nodeList, api.NodeExternalIP) config.externalAddrs = framework.NodeAddresses(nodeList, api.NodeExternalIP)
if len(config.externalAddrs) < 2 { if len(config.externalAddrs) < 2 {
@ -501,6 +502,7 @@ func (config *KubeProxyTestConfig) cleanup() {
} }
func (config *KubeProxyTestConfig) createNetProxyPods(podName string, selector map[string]string) []*api.Pod { func (config *KubeProxyTestConfig) createNetProxyPods(podName string, selector map[string]string) []*api.Pod {
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(config.f.Client))
nodes := framework.GetReadySchedulableNodesOrDie(config.f.Client) nodes := framework.GetReadySchedulableNodesOrDie(config.f.Client)
// create pods, one for each node // create pods, one for each node

View File

@ -111,6 +111,7 @@ var _ = framework.KubeDescribe("Networking", func() {
By("Creating a webserver (pending) pod on each node") By("Creating a webserver (pending) pod on each node")
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(f.Client))
nodes := framework.GetReadySchedulableNodesOrDie(f.Client) nodes := framework.GetReadySchedulableNodesOrDie(f.Client)
if len(nodes.Items) == 1 { if len(nodes.Items) == 1 {