mirror of https://github.com/k3s-io/k3s
Merge pull request #53634 from m1093782566/win-session
Automatic merge from submit-queue (batch tested with PRs 54656, 54552, 54389, 53634, 54408). 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>. Remove hard code of session affinity timeout in winows kernel proxy **What this PR does / why we need it**: Remove hard code of session affinity timeout in winows kernel proxy - we have already done this in userspace, iptables and ipvs proxy. **Which issue this PR fixes**: fixes #53636 **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` /sig network /area kube-proxypull/6/head
commit
6fbd2a1a30
|
@ -93,7 +93,7 @@ type serviceInfo struct {
|
|||
targetPort int
|
||||
loadBalancerStatus api.LoadBalancerStatus
|
||||
sessionAffinityType api.ServiceAffinity
|
||||
stickyMaxAgeMinutes int
|
||||
stickyMaxAgeSeconds int
|
||||
externalIPs []*externalIPInfo
|
||||
loadBalancerIngressIPs []*loadBalancerIngressInfo
|
||||
loadBalancerSourceRanges []string
|
||||
|
@ -165,6 +165,12 @@ func newServiceInfo(svcPortName proxy.ServicePortName, port *api.ServicePort, se
|
|||
onlyNodeLocalEndpoints = true
|
||||
}
|
||||
|
||||
// set default session sticky max age 180min=10800s
|
||||
stickyMaxAgeSeconds := 10800
|
||||
if service.Spec.SessionAffinity == api.ServiceAffinityClientIP {
|
||||
// Kube-apiserver side guarantees SessionAffinityConfig won't be nil when session affinity type is ClientIP
|
||||
stickyMaxAgeSeconds = int(*service.Spec.SessionAffinityConfig.ClientIP.TimeoutSeconds)
|
||||
}
|
||||
info := &serviceInfo{
|
||||
clusterIP: net.ParseIP(service.Spec.ClusterIP),
|
||||
port: int(port.Port),
|
||||
|
@ -174,7 +180,7 @@ func newServiceInfo(svcPortName proxy.ServicePortName, port *api.ServicePort, se
|
|||
// Deep-copy in case the service instance changes
|
||||
loadBalancerStatus: *helper.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer),
|
||||
sessionAffinityType: service.Spec.SessionAffinity,
|
||||
stickyMaxAgeMinutes: 180, // TODO: paramaterize this in the API.
|
||||
stickyMaxAgeSeconds: stickyMaxAgeSeconds,
|
||||
loadBalancerSourceRanges: make([]string, len(service.Spec.LoadBalancerSourceRanges)),
|
||||
onlyNodeLocalEndpoints: onlyNodeLocalEndpoints,
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import (
|
|||
func newFakeServiceInfo(service proxy.ServicePortName, ip net.IP, port int, protocol api.Protocol, onlyNodeLocalEndpoints bool) *serviceInfo {
|
||||
return &serviceInfo{
|
||||
sessionAffinityType: api.ServiceAffinityNone, // default
|
||||
stickyMaxAgeMinutes: 180,
|
||||
stickyMaxAgeSeconds: int(api.DefaultClientIPServiceAffinitySeconds), // default
|
||||
clusterIP: ip,
|
||||
port: port,
|
||||
protocol: protocol,
|
||||
|
|
Loading…
Reference in New Issue