Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
46b4614c
Commit
46b4614c
authored
Oct 10, 2017
by
m1093782566
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove hard code of session affinity timeout in win-proxy
parent
6e2249b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
proxier.go
pkg/proxy/winkernel/proxier.go
+8
-2
proxier_test.go
pkg/proxy/winkernel/proxier_test.go
+2
-2
No files found.
pkg/proxy/winkernel/proxier.go
View file @
46b4614c
...
@@ -93,7 +93,7 @@ type serviceInfo struct {
...
@@ -93,7 +93,7 @@ type serviceInfo struct {
targetPort
int
targetPort
int
loadBalancerStatus
api
.
LoadBalancerStatus
loadBalancerStatus
api
.
LoadBalancerStatus
sessionAffinityType
api
.
ServiceAffinity
sessionAffinityType
api
.
ServiceAffinity
stickyMaxAge
Minute
s
int
stickyMaxAge
Second
s
int
externalIPs
[]
*
externalIPInfo
externalIPs
[]
*
externalIPInfo
loadBalancerIngressIPs
[]
*
loadBalancerIngressInfo
loadBalancerIngressIPs
[]
*
loadBalancerIngressInfo
loadBalancerSourceRanges
[]
string
loadBalancerSourceRanges
[]
string
...
@@ -165,6 +165,12 @@ func newServiceInfo(svcPortName proxy.ServicePortName, port *api.ServicePort, se
...
@@ -165,6 +165,12 @@ func newServiceInfo(svcPortName proxy.ServicePortName, port *api.ServicePort, se
onlyNodeLocalEndpoints
=
true
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
{
info
:=
&
serviceInfo
{
clusterIP
:
net
.
ParseIP
(
service
.
Spec
.
ClusterIP
),
clusterIP
:
net
.
ParseIP
(
service
.
Spec
.
ClusterIP
),
port
:
int
(
port
.
Port
),
port
:
int
(
port
.
Port
),
...
@@ -174,7 +180,7 @@ func newServiceInfo(svcPortName proxy.ServicePortName, port *api.ServicePort, se
...
@@ -174,7 +180,7 @@ func newServiceInfo(svcPortName proxy.ServicePortName, port *api.ServicePort, se
// Deep-copy in case the service instance changes
// Deep-copy in case the service instance changes
loadBalancerStatus
:
*
helper
.
LoadBalancerStatusDeepCopy
(
&
service
.
Status
.
LoadBalancer
),
loadBalancerStatus
:
*
helper
.
LoadBalancerStatusDeepCopy
(
&
service
.
Status
.
LoadBalancer
),
sessionAffinityType
:
service
.
Spec
.
SessionAffinity
,
sessionAffinityType
:
service
.
Spec
.
SessionAffinity
,
stickyMaxAge
Minutes
:
180
,
// TODO: paramaterize this in the API.
stickyMaxAge
Seconds
:
stickyMaxAgeSeconds
,
loadBalancerSourceRanges
:
make
([]
string
,
len
(
service
.
Spec
.
LoadBalancerSourceRanges
)),
loadBalancerSourceRanges
:
make
([]
string
,
len
(
service
.
Spec
.
LoadBalancerSourceRanges
)),
onlyNodeLocalEndpoints
:
onlyNodeLocalEndpoints
,
onlyNodeLocalEndpoints
:
onlyNodeLocalEndpoints
,
}
}
...
...
pkg/proxy/winkernel/proxier_test.go
View file @
46b4614c
...
@@ -42,8 +42,8 @@ import (
...
@@ -42,8 +42,8 @@ import (
func
newFakeServiceInfo
(
service
proxy
.
ServicePortName
,
ip
net
.
IP
,
port
int
,
protocol
api
.
Protocol
,
onlyNodeLocalEndpoints
bool
)
*
serviceInfo
{
func
newFakeServiceInfo
(
service
proxy
.
ServicePortName
,
ip
net
.
IP
,
port
int
,
protocol
api
.
Protocol
,
onlyNodeLocalEndpoints
bool
)
*
serviceInfo
{
return
&
serviceInfo
{
return
&
serviceInfo
{
sessionAffinityType
:
api
.
ServiceAffinityNone
,
// default
sessionAffinityType
:
api
.
ServiceAffinityNone
,
// default
stickyMaxAge
Minutes
:
180
,
stickyMaxAge
Seconds
:
int
(
api
.
DefaultClientIPServiceAffinitySeconds
),
// default
clusterIP
:
ip
,
clusterIP
:
ip
,
port
:
port
,
port
:
port
,
protocol
:
protocol
,
protocol
:
protocol
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment