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
5cb8e8e1
Commit
5cb8e8e1
authored
Oct 10, 2016
by
bprashanth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix health check node port leak
parent
cb03ed36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
proxier.go
pkg/proxy/iptables/proxier.go
+4
-1
No files found.
pkg/proxy/iptables/proxier.go
View file @
5cb8e8e1
...
@@ -455,18 +455,20 @@ func (proxier *Proxier) OnServiceUpdate(allServices []api.Service) {
...
@@ -455,18 +455,20 @@ func (proxier *Proxier) OnServiceUpdate(allServices []api.Service) {
info
.
loadBalancerStatus
=
*
api
.
LoadBalancerStatusDeepCopy
(
&
service
.
Status
.
LoadBalancer
)
info
.
loadBalancerStatus
=
*
api
.
LoadBalancerStatusDeepCopy
(
&
service
.
Status
.
LoadBalancer
)
info
.
sessionAffinityType
=
service
.
Spec
.
SessionAffinity
info
.
sessionAffinityType
=
service
.
Spec
.
SessionAffinity
info
.
loadBalancerSourceRanges
=
service
.
Spec
.
LoadBalancerSourceRanges
info
.
loadBalancerSourceRanges
=
service
.
Spec
.
LoadBalancerSourceRanges
info
.
onlyNodeLocalEndpoints
=
apiservice
.
NeedsHealthCheck
(
service
)
&&
featuregate
.
DefaultFeatureGate
.
ExternalTrafficLocalOnly
()
info
.
onlyNodeLocalEndpoints
=
apiservice
.
NeedsHealthCheck
(
service
)
&&
featuregate
.
DefaultFeatureGate
.
ExternalTrafficLocalOnly
()
&&
(
service
.
Spec
.
Type
==
api
.
ServiceTypeLoadBalancer
||
service
.
Spec
.
Type
==
api
.
ServiceTypeNodePort
)
if
info
.
onlyNodeLocalEndpoints
{
if
info
.
onlyNodeLocalEndpoints
{
p
:=
apiservice
.
GetServiceHealthCheckNodePort
(
service
)
p
:=
apiservice
.
GetServiceHealthCheckNodePort
(
service
)
if
p
==
0
{
if
p
==
0
{
glog
.
Errorf
(
"Service does not contain necessary annotation %v"
,
glog
.
Errorf
(
"Service does not contain necessary annotation %v"
,
apiservice
.
AnnotationHealthCheckNodePort
)
apiservice
.
AnnotationHealthCheckNodePort
)
}
else
{
}
else
{
glog
.
V
(
4
)
.
Infof
(
"Adding health check for %+v, port %v"
,
serviceName
.
NamespacedName
,
p
)
info
.
healthCheckNodePort
=
int
(
p
)
info
.
healthCheckNodePort
=
int
(
p
)
// Turn on healthcheck responder to listen on the health check nodePort
// Turn on healthcheck responder to listen on the health check nodePort
healthcheck
.
AddServiceListener
(
serviceName
.
NamespacedName
,
info
.
healthCheckNodePort
)
healthcheck
.
AddServiceListener
(
serviceName
.
NamespacedName
,
info
.
healthCheckNodePort
)
}
}
}
else
{
}
else
{
glog
.
V
(
4
)
.
Infof
(
"Deleting health check for %+v"
,
serviceName
.
NamespacedName
)
// Delete healthcheck responders, if any, previously listening for this service
// Delete healthcheck responders, if any, previously listening for this service
healthcheck
.
DeleteServiceListener
(
serviceName
.
NamespacedName
,
0
)
healthcheck
.
DeleteServiceListener
(
serviceName
.
NamespacedName
,
0
)
}
}
...
@@ -488,6 +490,7 @@ func (proxier *Proxier) OnServiceUpdate(allServices []api.Service) {
...
@@ -488,6 +490,7 @@ func (proxier *Proxier) OnServiceUpdate(allServices []api.Service) {
if
info
.
onlyNodeLocalEndpoints
&&
info
.
healthCheckNodePort
>
0
{
if
info
.
onlyNodeLocalEndpoints
&&
info
.
healthCheckNodePort
>
0
{
// Remove ServiceListener health check nodePorts from the health checker
// Remove ServiceListener health check nodePorts from the health checker
// TODO - Stats
// TODO - Stats
glog
.
V
(
4
)
.
Infof
(
"Deleting health check for %+v, port %v"
,
name
.
NamespacedName
,
info
.
healthCheckNodePort
)
healthcheck
.
DeleteServiceListener
(
name
.
NamespacedName
,
info
.
healthCheckNodePort
)
healthcheck
.
DeleteServiceListener
(
name
.
NamespacedName
,
info
.
healthCheckNodePort
)
}
}
}
}
...
...
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