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
b6860f7f
Unverified
Commit
b6860f7f
authored
May 01, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77298 from JieJhih/iptables/endpoints
combine two logics avoid for range the same thing
parents
5bfa8f3c
176d4930
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
proxier.go
pkg/proxy/iptables/proxier.go
+9
-11
No files found.
pkg/proxy/iptables/proxier.go
View file @
b6860f7f
...
...
@@ -1152,7 +1152,16 @@ func (proxier *Proxier) syncProxyRules() {
// Now write loadbalancing & DNAT rules.
n
:=
len
(
endpointChains
)
localEndpoints
:=
make
([]
*
endpointsInfo
,
0
)
localEndpointChains
:=
make
([]
utiliptables
.
Chain
,
0
)
for
i
,
endpointChain
:=
range
endpointChains
{
// Write ingress loadbalancing & DNAT rules only for services that request OnlyLocal traffic.
if
svcInfo
.
OnlyNodeLocalEndpoints
&&
endpoints
[
i
]
.
IsLocal
{
// These slices parallel each other; must be kept in sync
localEndpoints
=
append
(
localEndpoints
,
endpoints
[
i
])
localEndpointChains
=
append
(
localEndpointChains
,
endpointChains
[
i
])
}
epIP
:=
endpoints
[
i
]
.
IP
()
if
epIP
==
""
{
// Error parsing this endpoint has been logged. Skip to next endpoint.
...
...
@@ -1193,17 +1202,6 @@ func (proxier *Proxier) syncProxyRules() {
continue
}
// Now write ingress loadbalancing & DNAT rules only for services that request OnlyLocal traffic.
// TODO - This logic may be combinable with the block above that creates the svc balancer chain
localEndpoints
:=
make
([]
*
endpointsInfo
,
0
)
localEndpointChains
:=
make
([]
utiliptables
.
Chain
,
0
)
for
i
:=
range
endpointChains
{
if
endpoints
[
i
]
.
IsLocal
{
// These slices parallel each other; must be kept in sync
localEndpoints
=
append
(
localEndpoints
,
endpoints
[
i
])
localEndpointChains
=
append
(
localEndpointChains
,
endpointChains
[
i
])
}
}
// First rule in the chain redirects all pod -> external VIP traffic to the
// Service's ClusterIP instead. This happens whether or not we have local
// endpoints; only if clusterCIDR is specified
...
...
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