mirror of https://github.com/k3s-io/k3s
Merge pull request #27008 from zmerlynn/e2e-routes
Networking e2es: Wait for all nodes to be schedulable in kubeproxy and networking testspull/6/head
commit
878c8d41f1
|
@ -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(),
|
||||
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue