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
aee5b809
Commit
aee5b809
authored
Oct 28, 2016
by
bprashanth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip legacy features (hostport, bwshaping)
parent
7c2aeecd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
11 deletions
+32
-11
kubenet_linux.go
pkg/kubelet/network/kubenet/kubenet_linux.go
+32
-11
No files found.
pkg/kubelet/network/kubenet/kubenet_linux.go
View file @
aee5b809
...
@@ -334,6 +334,9 @@ func (plugin *kubenetNetworkPlugin) Capabilities() utilsets.Int {
...
@@ -334,6 +334,9 @@ func (plugin *kubenetNetworkPlugin) Capabilities() utilsets.Int {
return
utilsets
.
NewInt
(
network
.
NET_PLUGIN_CAPABILITY_SHAPING
)
return
utilsets
.
NewInt
(
network
.
NET_PLUGIN_CAPABILITY_SHAPING
)
}
}
// setup sets up networking through CNI using the given ns/name and sandbox ID.
// TODO: Don't pass the pod to this method, it only needs it for bandwidth
// shaping and hostport management.
func
(
plugin
*
kubenetNetworkPlugin
)
setup
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
,
pod
*
api
.
Pod
)
error
{
func
(
plugin
*
kubenetNetworkPlugin
)
setup
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
,
pod
*
api
.
Pod
)
error
{
// Bring up container loopback interface
// Bring up container loopback interface
if
_
,
err
:=
plugin
.
addContainerToNetwork
(
plugin
.
loConfig
,
"lo"
,
namespace
,
name
,
id
);
err
!=
nil
{
if
_
,
err
:=
plugin
.
addContainerToNetwork
(
plugin
.
loConfig
,
"lo"
,
namespace
,
name
,
id
);
err
!=
nil
{
...
@@ -384,6 +387,14 @@ func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kube
...
@@ -384,6 +387,14 @@ func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kube
plugin
.
syncEbtablesDedupRules
(
macAddr
)
plugin
.
syncEbtablesDedupRules
(
macAddr
)
}
}
plugin
.
podIPs
[
id
]
=
ip4
.
String
()
// The host can choose to not support "legacy" features. The remote
// shim doesn't support it (#35457), but the kubelet does.
if
!
plugin
.
host
.
SupportsLegacyFeatures
()
{
return
nil
}
// The first SetUpPod call creates the bridge; get a shaper for the sake of
// The first SetUpPod call creates the bridge; get a shaper for the sake of
// initialization
// initialization
shaper
:=
plugin
.
shaper
()
shaper
:=
plugin
.
shaper
()
...
@@ -398,8 +409,6 @@ func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kube
...
@@ -398,8 +409,6 @@ func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kube
}
}
}
}
plugin
.
podIPs
[
id
]
=
ip4
.
String
()
// Open any hostports the pod's containers want
// Open any hostports the pod's containers want
activePods
,
err
:=
plugin
.
getActivePods
()
activePods
,
err
:=
plugin
.
getActivePods
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -423,6 +432,7 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
...
@@ -423,6 +432,7 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
glog
.
V
(
4
)
.
Infof
(
"SetUpPod took %v for %s/%s"
,
time
.
Since
(
start
),
namespace
,
name
)
glog
.
V
(
4
)
.
Infof
(
"SetUpPod took %v for %s/%s"
,
time
.
Since
(
start
),
namespace
,
name
)
}()
}()
// TODO: Entire pod object only required for bw shaping and hostport.
pod
,
ok
:=
plugin
.
host
.
GetPodByName
(
namespace
,
name
)
pod
,
ok
:=
plugin
.
host
.
GetPodByName
(
namespace
,
name
)
if
!
ok
{
if
!
ok
{
return
fmt
.
Errorf
(
"pod %q cannot be found"
,
name
)
return
fmt
.
Errorf
(
"pod %q cannot be found"
,
name
)
...
@@ -440,15 +450,20 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
...
@@ -440,15 +450,20 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
glog
.
V
(
4
)
.
Infof
(
"Failed to clean up %s/%s after SetUpPod failure: %v"
,
namespace
,
name
,
err
)
glog
.
V
(
4
)
.
Infof
(
"Failed to clean up %s/%s after SetUpPod failure: %v"
,
namespace
,
name
,
err
)
}
}
// TODO: Remove this hack once we've figured out how to retrieve the netns
// TODO(#34278): Figure out if we need IP GC through the cri.
// of an exited container. Currently, restarting docker will leak a bunch of
// The cri should always send us teardown events for stale sandboxes,
// ips. This will exhaust available ip space unless we cleanup old ips. At the
// this obviates the need for GC in the common case, for kubenet.
// same time we don't want to try GC'ing them periodically as that could lead
if
plugin
.
host
.
SupportsLegacyFeatures
()
{
// to a performance regression in starting pods. So on each setup failure, try
// GC on the assumption that the kubelet is going to retry pod creation, and
// TODO: Remove this hack once we've figured out how to retrieve the netns
// when it does, there will be ips.
// of an exited container. Currently, restarting docker will leak a bunch of
plugin
.
ipamGarbageCollection
()
// ips. This will exhaust available ip space unless we cleanup old ips. At the
// same time we don't want to try GC'ing them periodically as that could lead
// to a performance regression in starting pods. So on each setup failure, try
// GC on the assumption that the kubelet is going to retry pod creation, and
// when it does, there will be ips.
plugin
.
ipamGarbageCollection
()
}
return
err
return
err
}
}
...
@@ -485,6 +500,12 @@ func (plugin *kubenetNetworkPlugin) teardown(namespace string, name string, id k
...
@@ -485,6 +500,12 @@ func (plugin *kubenetNetworkPlugin) teardown(namespace string, name string, id k
}
}
}
}
// The host can choose to not support "legacy" features. The remote
// shim doesn't support it (#35457), but the kubelet does.
if
!
plugin
.
host
.
SupportsLegacyFeatures
()
{
return
utilerrors
.
NewAggregate
(
errList
)
}
activePods
,
err
:=
plugin
.
getActivePods
()
activePods
,
err
:=
plugin
.
getActivePods
()
if
err
==
nil
{
if
err
==
nil
{
err
=
plugin
.
hostportHandler
.
SyncHostports
(
BridgeName
,
activePods
)
err
=
plugin
.
hostportHandler
.
SyncHostports
(
BridgeName
,
activePods
)
...
...
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