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
be290b59
Commit
be290b59
authored
Sep 02, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Sep 02, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #31931 from freehan/kubenetcheck
Automatic merge from submit-queue kubenet checks required cni plugins are present related to #31215
parents
c3377788
20ed879f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
kubenet_linux.go
pkg/kubelet/network/kubenet/kubenet_linux.go
+37
-0
No files found.
pkg/kubelet/network/kubenet/kubenet_linux.go
View file @
be290b59
...
@@ -69,6 +69,9 @@ const (
...
@@ -69,6 +69,9 @@ const (
dedupChain
=
utilebtables
.
Chain
(
"KUBE-DEDUP"
)
dedupChain
=
utilebtables
.
Chain
(
"KUBE-DEDUP"
)
)
)
// CNI plugins required by kubenet in /opt/cni/bin or vendor directory
var
requiredCNIPlugins
=
[
...
]
string
{
"bridge"
,
"host-local"
,
"loopback"
}
type
kubenetNetworkPlugin
struct
{
type
kubenetNetworkPlugin
struct
{
network
.
NoopNetworkPlugin
network
.
NoopNetworkPlugin
...
@@ -531,9 +534,43 @@ func (plugin *kubenetNetworkPlugin) Status() error {
...
@@ -531,9 +534,43 @@ func (plugin *kubenetNetworkPlugin) Status() error {
if
plugin
.
netConfig
==
nil
{
if
plugin
.
netConfig
==
nil
{
return
fmt
.
Errorf
(
"Kubenet does not have netConfig. This is most likely due to lack of PodCIDR"
)
return
fmt
.
Errorf
(
"Kubenet does not have netConfig. This is most likely due to lack of PodCIDR"
)
}
}
if
!
plugin
.
checkCNIPlugin
()
{
return
fmt
.
Errorf
(
"could not locate kubenet required CNI plugins %v at %q or %q"
,
requiredCNIPlugins
,
DefaultCNIDir
,
plugin
.
vendorDir
)
}
return
nil
return
nil
}
}
// checkCNIPlugin returns if all kubenet required cni plugins can be found at /opt/cni/bin or user specifed NetworkPluginDir.
func
(
plugin
*
kubenetNetworkPlugin
)
checkCNIPlugin
()
bool
{
if
plugin
.
checkCNIPluginInDir
(
DefaultCNIDir
)
||
plugin
.
checkCNIPluginInDir
(
plugin
.
vendorDir
)
{
return
true
}
return
false
}
// checkCNIPluginInDir returns if all required cni plugins are placed in dir
func
(
plugin
*
kubenetNetworkPlugin
)
checkCNIPluginInDir
(
dir
string
)
bool
{
output
,
err
:=
plugin
.
execer
.
Command
(
"ls"
,
dir
)
.
CombinedOutput
()
if
err
!=
nil
{
return
false
}
fields
:=
strings
.
Fields
(
string
(
output
))
for
_
,
cniPlugin
:=
range
requiredCNIPlugins
{
found
:=
false
for
_
,
file
:=
range
fields
{
if
strings
.
TrimSpace
(
file
)
==
cniPlugin
{
found
=
true
break
}
}
if
!
found
{
return
false
}
}
return
true
}
// Returns a list of pods running on this node and each pod's IP address. Assumes
// Returns a list of pods running on this node and each pod's IP address. Assumes
// PodSpecs retrieved from the runtime include the name and ID of containers in
// PodSpecs retrieved from the runtime include the name and ID of containers in
// each pod.
// each pod.
...
...
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