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
718d7df2
Commit
718d7df2
authored
Oct 02, 2015
by
qiaolei
Committed by
hw-qiaolei
Oct 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some typos
parent
9659ab13
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
10 deletions
+10
-10
api.go
pkg/proxy/config/api.go
+1
-1
proxier.go
pkg/proxy/iptables/proxier.go
+2
-2
proxier.go
pkg/proxy/userspace/proxier.go
+4
-4
roundrobin.go
pkg/proxy/userspace/roundrobin.go
+1
-1
iptables.go
pkg/util/iptables/iptables.go
+2
-2
No files found.
pkg/proxy/config/api.go
View file @
718d7df2
...
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/fields"
)
// NewSourceAPI
server
creates config source that watches for changes to the services and endpoints.
// NewSourceAPI creates config source that watches for changes to the services and endpoints.
func
NewSourceAPI
(
c
*
client
.
Client
,
period
time
.
Duration
,
servicesChan
chan
<-
ServiceUpdate
,
endpointsChan
chan
<-
EndpointsUpdate
)
{
servicesLW
:=
cache
.
NewListWatchFromClient
(
c
,
"services"
,
api
.
NamespaceAll
,
fields
.
Everything
())
endpointsLW
:=
cache
.
NewListWatchFromClient
(
c
,
"endpoints"
,
api
.
NamespaceAll
,
fields
.
Everything
())
...
...
pkg/proxy/iptables/proxier.go
View file @
718d7df2
...
...
@@ -66,7 +66,7 @@ const iptablesMasqueradeMark = "0x4d415351"
// ShouldUseIptablesProxier returns true if we should use the iptables Proxier
// instead of the "classic" userspace Proxier. This is determined by checking
// the iptables version and for the existence of kernel features. It may return
// an error if it fails to get the i
tp
ables version without error, in which
// an error if it fails to get the i
pt
ables version without error, in which
// case it will also return false.
func
ShouldUseIptablesProxier
()
(
bool
,
error
)
{
exec
:=
utilexec
.
New
()
...
...
@@ -479,7 +479,7 @@ func (proxier *Proxier) syncProxyRules() {
existingChains
:=
make
(
map
[
utiliptables
.
Chain
]
string
)
iptablesSaveRaw
,
err
:=
proxier
.
iptables
.
Save
(
utiliptables
.
TableNAT
)
if
err
!=
nil
{
// if we failed to get any rules
glog
.
Errorf
(
"Failed to execute iptable-save, syncing all rules. %s"
,
err
.
Error
())
glog
.
Errorf
(
"Failed to execute iptable
s
-save, syncing all rules. %s"
,
err
.
Error
())
}
else
{
// otherwise parse the output
existingChains
=
getChainLines
(
utiliptables
.
TableNAT
,
iptablesSaveRaw
)
}
...
...
pkg/proxy/userspace/proxier.go
View file @
718d7df2
...
...
@@ -97,7 +97,7 @@ type Proxier struct {
// assert Proxier is a ProxyProvider
var
_
proxy
.
ProxyProvider
=
&
Proxier
{}
// A key for the portMap. The ip has to be a tring because slices can't be map
// A key for the portMap. The ip has to be a
s
tring because slices can't be map
// keys.
type
portMapKey
struct
{
ip
string
...
...
@@ -208,7 +208,7 @@ func CleanupLeftovers(ipt iptables.Interface) (encounteredError bool) {
// flush and delete chains.
chains
:=
[]
iptables
.
Chain
{
iptablesContainerPortalChain
,
iptablesHostPortalChain
,
iptablesHostNodePortChain
,
iptablesContainerNodePortChain
}
for
_
,
c
:=
range
chains
{
// flush chain, then if sucessful delete, delete will fail if flush fails.
// flush chain, then if suc
c
essful delete, delete will fail if flush fails.
if
err
:=
ipt
.
FlushChain
(
iptables
.
TableNAT
,
c
);
err
!=
nil
{
glog
.
Errorf
(
"Error flushing userspace chain: %v"
,
err
)
encounteredError
=
true
...
...
@@ -338,7 +338,7 @@ func (proxier *Proxier) addServiceOnPort(service proxy.ServicePortName, protocol
// How long we leave idle UDP connections open.
const
udpIdleTimeout
=
1
*
time
.
Second
// OnUpdate manages the active set of service proxies.
// On
Service
Update manages the active set of service proxies.
// Active service proxies are reinitialized if found in the update set or
// shutdown if missing from the update set.
func
(
proxier
*
Proxier
)
OnServiceUpdate
(
services
[]
api
.
Service
)
{
...
...
@@ -913,7 +913,7 @@ func (proxier *Proxier) iptablesHostPortalArgs(destIP net.IP, addDstLocalMatch b
// If the proxy is bound (see Proxier.listenIP) to 0.0.0.0 ("any
// interface") we want to do the same as from-container traffic and use
// REDIRECT. Except that it doesn't work (empirically). REDIRECT on
// localpackets sends the traffic to localhost (special case, but it is
// local
packets sends the traffic to localhost (special case, but it is
// documented) but the response comes from the eth0 IP (not sure why,
// truthfully), which makes DNS unhappy.
//
...
...
pkg/proxy/userspace/roundrobin.go
View file @
718d7df2
...
...
@@ -91,7 +91,7 @@ func (lb *LoadBalancerRR) NewService(svcPort proxy.ServicePortName, affinityType
// This assumes that lb.lock is already held.
func
(
lb
*
LoadBalancerRR
)
newServiceInternal
(
svcPort
proxy
.
ServicePortName
,
affinityType
api
.
ServiceAffinity
,
ttlMinutes
int
)
*
balancerState
{
if
ttlMinutes
==
0
{
ttlMinutes
=
180
//default to 3 hours if not specified. Should 0 be unlim
e
ted instead????
ttlMinutes
=
180
//default to 3 hours if not specified. Should 0 be unlim
i
ted instead????
}
if
_
,
exists
:=
lb
.
services
[
svcPort
];
!
exists
{
...
...
pkg/util/iptables/iptables.go
View file @
718d7df2
...
...
@@ -106,7 +106,7 @@ type RestoreCountersFlag bool
const
RestoreCounters
RestoreCountersFlag
=
true
const
NoRestoreCounters
RestoreCountersFlag
=
false
// Option flag for
Restore
// Option flag for
Flush
type
FlushFlag
bool
const
FlushTables
FlushFlag
=
true
...
...
@@ -226,7 +226,7 @@ func (runner *runner) DeleteChain(table Table, chain Chain) error {
runner
.
mu
.
Lock
()
defer
runner
.
mu
.
Unlock
()
// TODO: we could call iptable -S first, ignore the output and check for non-zero return (more like DeleteRule)
// TODO: we could call iptable
s
-S first, ignore the output and check for non-zero return (more like DeleteRule)
out
,
err
:=
runner
.
run
(
opDeleteChain
,
fullArgs
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error deleting chain %q: %v: %s"
,
chain
,
err
,
out
)
...
...
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