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
9052edda
Commit
9052edda
authored
May 07, 2016
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't delete affinity when endpoints are empty
This only affects the userspace kube-proxy.
parent
f500194d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
loadbalancer.go
pkg/proxy/userspace/loadbalancer.go
+1
-0
proxier.go
pkg/proxy/userspace/proxier.go
+1
-0
roundrobin.go
pkg/proxy/userspace/roundrobin.go
+13
-1
No files found.
pkg/proxy/userspace/loadbalancer.go
View file @
9052edda
...
...
@@ -29,5 +29,6 @@ type LoadBalancer interface {
// service-port and source address.
NextEndpoint
(
service
proxy
.
ServicePortName
,
srcAddr
net
.
Addr
)
(
string
,
error
)
NewService
(
service
proxy
.
ServicePortName
,
sessionAffinityType
api
.
ServiceAffinity
,
stickyMaxAgeMinutes
int
)
error
DeleteService
(
service
proxy
.
ServicePortName
)
CleanupStaleStickySessions
(
service
proxy
.
ServicePortName
)
}
pkg/proxy/userspace/proxier.go
View file @
9052edda
...
...
@@ -447,6 +447,7 @@ func (proxier *Proxier) OnServiceUpdate(services []api.Service) {
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to stop service %q: %v"
,
name
,
err
)
}
proxier
.
loadBalancer
.
DeleteService
(
name
)
}
}
}
...
...
pkg/proxy/userspace/roundrobin.go
View file @
9052edda
...
...
@@ -82,6 +82,7 @@ func NewLoadBalancerRR() *LoadBalancerRR {
}
func
(
lb
*
LoadBalancerRR
)
NewService
(
svcPort
proxy
.
ServicePortName
,
affinityType
api
.
ServiceAffinity
,
ttlMinutes
int
)
error
{
glog
.
V
(
4
)
.
Infof
(
"LoadBalancerRR NewService %q"
,
svcPort
)
lb
.
lock
.
Lock
()
defer
lb
.
lock
.
Unlock
()
lb
.
newServiceInternal
(
svcPort
,
affinityType
,
ttlMinutes
)
...
...
@@ -103,6 +104,13 @@ func (lb *LoadBalancerRR) newServiceInternal(svcPort proxy.ServicePortName, affi
return
lb
.
services
[
svcPort
]
}
func
(
lb
*
LoadBalancerRR
)
DeleteService
(
svcPort
proxy
.
ServicePortName
)
{
glog
.
V
(
4
)
.
Infof
(
"LoadBalancerRR DeleteService %q"
,
svcPort
)
lb
.
lock
.
Lock
()
defer
lb
.
lock
.
Unlock
()
delete
(
lb
.
services
,
svcPort
)
}
// return true if this service is using some form of session affinity.
func
isSessionAffinity
(
affinity
*
affinityPolicy
)
bool
{
// Should never be empty string, but checking for it to be safe.
...
...
@@ -279,7 +287,11 @@ func (lb *LoadBalancerRR) OnEndpointsUpdate(allEndpoints []api.Endpoints) {
for
k
:=
range
lb
.
services
{
if
_
,
exists
:=
registeredEndpoints
[
k
];
!
exists
{
glog
.
V
(
2
)
.
Infof
(
"LoadBalancerRR: Removing endpoints for %s"
,
k
)
delete
(
lb
.
services
,
k
)
// Reset but don't delete.
state
:=
lb
.
services
[
k
]
state
.
endpoints
=
[]
string
{}
state
.
index
=
0
state
.
affinity
.
affinityMap
=
map
[
string
]
*
affinityState
{}
}
}
}
...
...
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