mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-03 18:27:49 +00:00
Speed up some networking tests in large clusters
This commit is contained in:
@@ -52,7 +52,7 @@ const (
|
|||||||
// because we verify iptables statistical rr loadbalancing.
|
// because we verify iptables statistical rr loadbalancing.
|
||||||
testTries = 30
|
testTries = 30
|
||||||
// Maximum number of pods in a test, to make test work in large clusters.
|
// Maximum number of pods in a test, to make test work in large clusters.
|
||||||
maxNetProxyPodsCount = 20
|
maxNetProxyPodsCount = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewNetworkingTestConfig creates and sets up a new test config helper.
|
// NewNetworkingTestConfig creates and sets up a new test config helper.
|
||||||
@@ -219,7 +219,9 @@ func (config *NetworkingTestConfig) DialFromContainer(protocol, containerIP, tar
|
|||||||
func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
||||||
var cmd string
|
var cmd string
|
||||||
if protocol == "udp" {
|
if protocol == "udp" {
|
||||||
cmd = fmt.Sprintf("echo 'hostName' | timeout -t 3 nc -w 1 -u %s %d", targetIP, targetPort)
|
// TODO: It would be enough to pass 1s+epsilon to timeout, but unfortunately
|
||||||
|
// busybox timeout doesn't support non-integer values.
|
||||||
|
cmd = fmt.Sprintf("echo 'hostName' | timeout -t 2 nc -w 1 -u %s %d", targetIP, targetPort)
|
||||||
} else {
|
} else {
|
||||||
cmd = fmt.Sprintf("curl -q -s --connect-timeout 1 http://%s:%d/hostName", targetIP, targetPort)
|
cmd = fmt.Sprintf("curl -q -s --connect-timeout 1 http://%s:%d/hostName", targetIP, targetPort)
|
||||||
}
|
}
|
||||||
@@ -486,8 +488,8 @@ func (config *NetworkingTestConfig) createNetProxyPods(podName string, selector
|
|||||||
nodeList := GetReadySchedulableNodesOrDie(config.f.Client)
|
nodeList := GetReadySchedulableNodesOrDie(config.f.Client)
|
||||||
|
|
||||||
// To make this test work reasonably fast in large clusters,
|
// To make this test work reasonably fast in large clusters,
|
||||||
// we limit the number of NetProxyPods to no more than 100 ones
|
// we limit the number of NetProxyPods to no more than
|
||||||
// on random nodes.
|
// maxNetProxyPodsCount on random nodes.
|
||||||
nodes := shuffleNodes(nodeList.Items)
|
nodes := shuffleNodes(nodeList.Items)
|
||||||
if len(nodes) > maxNetProxyPodsCount {
|
if len(nodes) > maxNetProxyPodsCount {
|
||||||
nodes = nodes[:maxNetProxyPodsCount]
|
nodes = nodes[:maxNetProxyPodsCount]
|
||||||
|
Reference in New Issue
Block a user