mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
add FlagPersistent flag in nodePort and other situation
This commit is contained in:
parent
be78d113b1
commit
ed802f1db7
@ -952,7 +952,6 @@ func (proxier *Proxier) syncProxyRules(reason syncReason) {
|
|||||||
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)
|
||||||
@ -1030,10 +1029,10 @@ func (proxier *Proxier) syncProxyRules(reason syncReason) {
|
|||||||
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`.
|
||||||
@ -1091,10 +1090,10 @@ func (proxier *Proxier) syncProxyRules(reason syncReason) {
|
|||||||
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`.
|
||||||
@ -1141,10 +1140,10 @@ func (proxier *Proxier) syncProxyRules(reason syncReason) {
|
|||||||
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`.
|
||||||
|
Loading…
Reference in New Issue
Block a user