kube-proxy: increase the session affinity timeout to ensure that the test passes in ipvs mode

Signed-off-by: SataQiu <1527062125@qq.com>
This commit is contained in:
SataQiu 2020-04-20 10:22:30 +08:00
parent 32540b0eaa
commit fc3d282b10

View File

@ -3227,6 +3227,18 @@ func execAffinityTestForSessionAffinityTimeout(f *framework.Framework, cs client
serviceType := svc.Spec.Type
// set an affinity timeout equal to the number of connection requests
svcSessionAffinityTimeout := int32(AffinityConfirmCount)
if proxyMode, err := proxyMode(f); err == nil {
if proxyMode == "ipvs" {
// session affinity timeout must be greater than 120 in ipvs mode,
// because IPVS module has a hardcoded TIME_WAIT timeout of 120s,
// and that value can't be sysctl'ed now.
// Ref: https://github.com/torvalds/linux/blob/master/net/netfilter/ipvs/ip_vs_proto_tcp.c
// TODO: remove this to speed up testing when IPVS does really respect session affinity timeout
svcSessionAffinityTimeout = int32(125)
}
} else {
framework.Logf("Couldn't detect KubeProxy mode - test failure may be expected: %v", err)
}
svc.Spec.SessionAffinity = v1.ServiceAffinityClientIP
svc.Spec.SessionAffinityConfig = &v1.SessionAffinityConfig{
ClientIP: &v1.ClientIPConfig{TimeoutSeconds: &svcSessionAffinityTimeout},