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
62e3285c
Commit
62e3285c
authored
May 22, 2018
by
liangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipvs lb local session affinity
parent
a0b1d4de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
proxier.go
pkg/proxy/ipvs/proxier.go
+8
-3
No files found.
pkg/proxy/ipvs/proxier.go
View file @
62e3285c
...
@@ -856,7 +856,7 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -856,7 +856,7 @@ func (proxier *Proxier) syncProxyRules() {
}
}
if
err
:=
proxier
.
syncService
(
svcNameString
,
serv
,
true
);
err
==
nil
{
if
err
:=
proxier
.
syncService
(
svcNameString
,
serv
,
true
);
err
==
nil
{
activeIPVSServices
[
serv
.
String
()]
=
true
activeIPVSServices
[
serv
.
String
()]
=
true
if
err
:=
proxier
.
syncEndpoint
(
svcName
,
svcInfo
.
OnlyNodeLocalEndpoints
,
serv
);
err
!=
nil
{
if
err
:=
proxier
.
syncEndpoint
(
svcName
,
false
,
serv
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to sync endpoint for service: %v, err: %v"
,
serv
,
err
)
glog
.
Errorf
(
"Failed to sync endpoint for service: %v, err: %v"
,
serv
,
err
)
}
}
}
else
{
}
else
{
...
@@ -955,8 +955,10 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -955,8 +955,10 @@ func (proxier *Proxier) syncProxyRules() {
serv
.
Timeout
=
uint32
(
svcInfo
.
StickyMaxAgeSeconds
)
serv
.
Timeout
=
uint32
(
svcInfo
.
StickyMaxAgeSeconds
)
}
}
if
err
:=
proxier
.
syncService
(
svcNameString
,
serv
,
true
);
err
==
nil
{
if
err
:=
proxier
.
syncService
(
svcNameString
,
serv
,
true
);
err
==
nil
{
// check if service need skip endpoints that not in same host as kube-proxy
onlyLocal
:=
svcInfo
.
SessionAffinityType
==
api
.
ServiceAffinityClientIP
&&
svcInfo
.
OnlyNodeLocalEndpoints
activeIPVSServices
[
serv
.
String
()]
=
true
activeIPVSServices
[
serv
.
String
()]
=
true
if
err
:=
proxier
.
syncEndpoint
(
svcName
,
svcInfo
.
OnlyNodeLocalEndpoints
,
serv
);
err
!=
nil
{
if
err
:=
proxier
.
syncEndpoint
(
svcName
,
onlyLocal
,
serv
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to sync endpoint for service: %v, err: %v"
,
serv
,
err
)
glog
.
Errorf
(
"Failed to sync endpoint for service: %v, err: %v"
,
serv
,
err
)
}
}
}
else
{
}
else
{
...
@@ -1084,7 +1086,7 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -1084,7 +1086,7 @@ func (proxier *Proxier) syncProxyRules() {
// 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`.
if
err
:=
proxier
.
syncService
(
svcNameString
,
serv
,
false
);
err
==
nil
{
if
err
:=
proxier
.
syncService
(
svcNameString
,
serv
,
false
);
err
==
nil
{
activeIPVSServices
[
serv
.
String
()]
=
true
activeIPVSServices
[
serv
.
String
()]
=
true
if
err
:=
proxier
.
syncEndpoint
(
svcName
,
svcInfo
.
OnlyNodeLocalEndpoints
,
serv
);
err
!=
nil
{
if
err
:=
proxier
.
syncEndpoint
(
svcName
,
false
,
serv
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to sync endpoint for service: %v, err: %v"
,
serv
,
err
)
glog
.
Errorf
(
"Failed to sync endpoint for service: %v, err: %v"
,
serv
,
err
)
}
}
}
else
{
}
else
{
...
@@ -1477,6 +1479,9 @@ func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNode
...
@@ -1477,6 +1479,9 @@ func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNode
}
}
for
_
,
epInfo
:=
range
proxier
.
endpointsMap
[
svcPortName
]
{
for
_
,
epInfo
:=
range
proxier
.
endpointsMap
[
svcPortName
]
{
if
onlyNodeLocalEndpoints
&&
!
epInfo
.
GetIsLocal
()
{
continue
}
newEndpoints
.
Insert
(
epInfo
.
String
())
newEndpoints
.
Insert
(
epInfo
.
String
())
}
}
...
...
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