add FlagPersistent flag in nodePort and other situation

pull/6/head
Lion-Wei 2017-09-13 14:47:58 +08:00
parent be78d113b1
commit ed802f1db7
1 changed files with 3 additions and 4 deletions

View File

@ -952,7 +952,6 @@ func (proxier *Proxier) syncProxyRules(reason syncReason) {
Scheduler: proxier.ipvsScheduler,
}
// Set session affinity flag and timeout for IPVS service
var flags utilipvs.ServiceFlags
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
@ -1030,10 +1029,10 @@ func (proxier *Proxier) syncProxyRules(reason syncReason) {
Address: net.ParseIP(externalIP),
Port: uint16(svcInfo.port),
Protocol: string(svcInfo.protocol),
Flags: flags,
Scheduler: proxier.ipvsScheduler,
}
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
}
// 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),
Port: uint16(svcInfo.port),
Protocol: string(svcInfo.protocol),
Flags: flags,
Scheduler: proxier.ipvsScheduler,
}
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
}
// 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,
Port: uint16(svcInfo.nodePort),
Protocol: string(svcInfo.protocol),
Flags: flags,
Scheduler: proxier.ipvsScheduler,
}
if svcInfo.sessionAffinityType == api.ServiceAffinityClientIP {
serv.Flags |= utilipvs.FlagPersistent
serv.Timeout = uint32(svcInfo.stickyMaxAgeSeconds)
}
// There is no need to bind Node IP to dummy interface, so set parameter `bindAddr` to `false`.