Skip to content

Commit fc3d282

Browse files
committed
kube-proxy: increase the session affinity timeout to ensure that the test passes in ipvs mode
Signed-off-by: SataQiu <[email protected]>
1 parent 32540b0 commit fc3d282

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/e2e/network/service.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,6 +3227,18 @@ func execAffinityTestForSessionAffinityTimeout(f *framework.Framework, cs client
32273227
serviceType := svc.Spec.Type
32283228
// set an affinity timeout equal to the number of connection requests
32293229
svcSessionAffinityTimeout := int32(AffinityConfirmCount)
3230+
if proxyMode, err := proxyMode(f); err == nil {
3231+
if proxyMode == "ipvs" {
3232+
// session affinity timeout must be greater than 120 in ipvs mode,
3233+
// because IPVS module has a hardcoded TIME_WAIT timeout of 120s,
3234+
// and that value can't be sysctl'ed now.
3235+
// Ref: https://github.com/torvalds/linux/blob/master/net/netfilter/ipvs/ip_vs_proto_tcp.c
3236+
// TODO: remove this to speed up testing when IPVS does really respect session affinity timeout
3237+
svcSessionAffinityTimeout = int32(125)
3238+
}
3239+
} else {
3240+
framework.Logf("Couldn't detect KubeProxy mode - test failure may be expected: %v", err)
3241+
}
32303242
svc.Spec.SessionAffinity = v1.ServiceAffinityClientIP
32313243
svc.Spec.SessionAffinityConfig = &v1.SessionAffinityConfig{
32323244
ClientIP: &v1.ClientIPConfig{TimeoutSeconds: &svcSessionAffinityTimeout},

0 commit comments

Comments
 (0)