Commit c7f72a63 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #52394 from Lion-Wei/ipvs-nodeport

Automatic merge from submit-queue (batch tested with PRs 50068, 52406, 52394, 48551, 52131). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.. add FlagPersistent flag in nodePort and other situation **What this PR does / why we need it**: For AffinityClientIP service, origin code in ipvs didn't add Persistent flag, which is a bug, so I added it. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #52626 **Special notes for your reviewer**: add FlagPersistent flag in nodePort and other situation **Release note**: ```release-note NONE ```
parents cb0ee6f2 ed802f1d
...@@ -984,7 +984,6 @@ func (proxier *Proxier) syncProxyRules() { ...@@ -984,7 +984,6 @@ func (proxier *Proxier) syncProxyRules() {
Scheduler: proxier.ipvsScheduler, Scheduler: proxier.ipvsScheduler,
} }
// Set session affinity flag and timeout for IPVS service // Set session affinity flag and timeout for IPVS service
var flags utilipvs.ServiceFlags
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP { if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds) serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
...@@ -1062,10 +1061,10 @@ func (proxier *Proxier) syncProxyRules() { ...@@ -1062,10 +1061,10 @@ func (proxier *Proxier) syncProxyRules() {
Address: net.ParseIP(externalIP), Address: net.ParseIP(externalIP),
Port: uint16(svcInfo.port), Port: uint16(svcInfo.port),
Protocol: string(svcInfo.protocol), Protocol: string(svcInfo.protocol),
Flags: flags,
Scheduler: proxier.ipvsScheduler, Scheduler: proxier.ipvsScheduler,
} }
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP { if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds) serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
} }
// There is no need to bind externalIP to dummy interface, so set parameter `bindAddr` to `false`. // There is no need to bind externalIP to dummy interface, so set parameter `bindAddr` to `false`.
...@@ -1123,10 +1122,10 @@ func (proxier *Proxier) syncProxyRules() { ...@@ -1123,10 +1122,10 @@ func (proxier *Proxier) syncProxyRules() {
Address: net.ParseIP(ingress.IP), Address: net.ParseIP(ingress.IP),
Port: uint16(svcInfo.port), Port: uint16(svcInfo.port),
Protocol: string(svcInfo.protocol), Protocol: string(svcInfo.protocol),
Flags: flags,
Scheduler: proxier.ipvsScheduler, Scheduler: proxier.ipvsScheduler,
} }
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP { if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds) serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
} }
// There is no need to bind LB ingress.IP to dummy interface, so set parameter `bindAddr` to `false`. // There is no need to bind LB ingress.IP to dummy interface, so set parameter `bindAddr` to `false`.
...@@ -1173,10 +1172,10 @@ func (proxier *Proxier) syncProxyRules() { ...@@ -1173,10 +1172,10 @@ func (proxier *Proxier) syncProxyRules() {
Address: nodeIP, Address: nodeIP,
Port: uint16(svcInfo.nodePort), Port: uint16(svcInfo.nodePort),
Protocol: string(svcInfo.protocol), Protocol: string(svcInfo.protocol),
Flags: flags,
Scheduler: proxier.ipvsScheduler, Scheduler: proxier.ipvsScheduler,
} }
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP { if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds) serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
} }
// There is no need to bind Node IP to dummy interface, so set parameter `bindAddr` to `false`. // There is no need to bind Node IP to dummy interface, so set parameter `bindAddr` to `false`.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment