Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Networking e2es: Wait for all nodes to be schedulable in kubeproxy and networking tests #27008

Merged
merged 1 commit into from
Jun 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions test/e2e/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,7 @@ func GetReadySchedulableNodesOrDie(c *client.Client) (nodes *api.NodeList) {
}

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{
ResourceVersion: "0",
FieldSelector: fields.Set{"spec.unschedulable": "false"}.AsSelector(),
Expand All @@ -2634,11 +2634,16 @@ func WaitForAllNodesSchedulable(c *client.Client) error {
// Ignore the error here - it will be retried.
return false, nil
}
schedulable := 0
for _, node := range nodes.Items {
if !isNodeSchedulable(&node) {
return false, nil
if isNodeSchedulable(&node) {
schedulable++
}
}
if schedulable != len(nodes.Items) {
Logf("%d/%d nodes schedulable (polling after 30s)", schedulable, len(nodes.Items))
return false, nil
}
return true, nil
})
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/kubeproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func (config *KubeProxyTestConfig) setup() {
}

By("Getting node addresses")
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(config.f.Client))
nodeList := framework.GetReadySchedulableNodesOrDie(config.f.Client)
config.externalAddrs = framework.NodeAddresses(nodeList, api.NodeExternalIP)
if len(config.externalAddrs) < 2 {
Expand Down Expand Up @@ -501,6 +502,7 @@ func (config *KubeProxyTestConfig) cleanup() {
}

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)

// create pods, one for each node
Expand Down
1 change: 1 addition & 0 deletions test/e2e/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var _ = framework.KubeDescribe("Networking", func() {

By("Creating a webserver (pending) pod on each node")

framework.ExpectNoError(framework.WaitForAllNodesSchedulable(f.Client))
nodes := framework.GetReadySchedulableNodesOrDie(f.Client)

if len(nodes.Items) == 1 {
Expand Down