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
04b80f7f
Commit
04b80f7f
authored
Apr 26, 2016
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename Status interface to GetPodNetworkStatus
parent
265fdd93
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
14 deletions
+14
-14
manager.go
pkg/kubelet/dockertools/manager.go
+1
-1
kubelet.go
pkg/kubelet/kubelet.go
+1
-1
cni.go
pkg/kubelet/network/cni/cni.go
+1
-1
exec.go
pkg/kubelet/network/exec/exec.go
+1
-1
exec_test.go
pkg/kubelet/network/exec/exec_test.go
+2
-2
kubenet_linux.go
pkg/kubelet/network/kubenet/kubenet_linux.go
+3
-3
kubenet_unsupported.go
pkg/kubelet/network/kubenet/kubenet_unsupported.go
+1
-1
plugins.go
pkg/kubelet/network/plugins.go
+4
-4
No files found.
pkg/kubelet/dockertools/manager.go
View file @
04b80f7f
...
...
@@ -326,7 +326,7 @@ func (dm *DockerManager) determineContainerIP(podNamespace, podName string, cont
}
if
dm
.
networkPlugin
.
Name
()
!=
network
.
DefaultPluginName
{
netStatus
,
err
:=
dm
.
networkPlugin
.
Status
(
podNamespace
,
podName
,
kubecontainer
.
DockerID
(
container
.
ID
)
.
ContainerID
())
netStatus
,
err
:=
dm
.
networkPlugin
.
GetPodNetwork
Status
(
podNamespace
,
podName
,
kubecontainer
.
DockerID
(
container
.
ID
)
.
ContainerID
())
if
err
!=
nil
{
glog
.
Errorf
(
"NetworkPlugin %s failed on the status hook for pod '%s' - %v"
,
dm
.
networkPlugin
.
Name
(),
podName
,
err
)
}
else
if
netStatus
!=
nil
{
...
...
pkg/kubelet/kubelet.go
View file @
04b80f7f
...
...
@@ -3007,7 +3007,7 @@ func (kl *Kubelet) syncNetworkStatus() {
}
}
kl
.
runtimeState
.
setNetworkState
(
kl
.
networkPlugin
.
Network
Status
())
kl
.
runtimeState
.
setNetworkState
(
kl
.
networkPlugin
.
Status
())
}
// Set addresses for the node.
...
...
pkg/kubelet/network/cni/cni.go
View file @
04b80f7f
...
...
@@ -136,7 +136,7 @@ func (plugin *cniNetworkPlugin) TearDownPod(namespace string, name string, id ku
// TODO: Use the addToNetwork function to obtain the IP of the Pod. That will assume idempotent ADD call to the plugin.
// Also fix the runtime's call to Status function to be done only in the case that the IP is lost, no need to do periodic calls
func
(
plugin
*
cniNetworkPlugin
)
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
func
(
plugin
*
cniNetworkPlugin
)
GetPodNetwork
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
runtime
,
ok
:=
plugin
.
host
.
GetRuntime
()
.
(
*
dockertools
.
DockerManager
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"CNI execution called on non-docker runtime"
)
...
...
pkg/kubelet/network/exec/exec.go
View file @
04b80f7f
...
...
@@ -146,7 +146,7 @@ func (plugin *execNetworkPlugin) TearDownPod(namespace string, name string, id k
return
err
}
func
(
plugin
*
execNetworkPlugin
)
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
func
(
plugin
*
execNetworkPlugin
)
GetPodNetwork
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
out
,
err
:=
utilexec
.
New
()
.
Command
(
plugin
.
getExecutable
(),
statusCmd
,
namespace
,
name
,
id
.
ID
)
.
CombinedOutput
()
glog
.
V
(
5
)
.
Infof
(
"Status 'exec' network plugin output: %s, %v"
,
string
(
out
),
err
)
if
err
!=
nil
{
...
...
pkg/kubelet/network/exec/exec_test.go
View file @
04b80f7f
...
...
@@ -281,7 +281,7 @@ func TestPluginStatusHook(t *testing.T) {
plug
,
err
:=
network
.
InitNetworkPlugin
(
ProbeNetworkPlugins
(
testPluginPath
),
pluginName
,
nettest
.
NewFakeHost
(
nil
))
ip
,
err
:=
plug
.
Status
(
"namespace"
,
"name"
,
kubecontainer
.
ContainerID
{
Type
:
"docker"
,
ID
:
"dockerid2345"
})
ip
,
err
:=
plug
.
GetPodNetwork
Status
(
"namespace"
,
"name"
,
kubecontainer
.
ContainerID
{
Type
:
"docker"
,
ID
:
"dockerid2345"
})
if
err
!=
nil
{
t
.
Errorf
(
"Expected nil got %v"
,
err
)
}
...
...
@@ -320,7 +320,7 @@ func TestPluginStatusHookIPv6(t *testing.T) {
t
.
Errorf
(
"InitNetworkPlugin() failed: %v"
,
err
)
}
ip
,
err
:=
plug
.
Status
(
"namespace"
,
"name"
,
kubecontainer
.
ContainerID
{
Type
:
"docker"
,
ID
:
"dockerid2345"
})
ip
,
err
:=
plug
.
GetPodNetwork
Status
(
"namespace"
,
"name"
,
kubecontainer
.
ContainerID
{
Type
:
"docker"
,
ID
:
"dockerid2345"
})
if
err
!=
nil
{
t
.
Errorf
(
"Status() failed: %v"
,
err
)
}
...
...
pkg/kubelet/network/kubenet/kubenet_linux.go
View file @
04b80f7f
...
...
@@ -215,7 +215,7 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
return
fmt
.
Errorf
(
"Error reading pod bandwidth annotations: %v"
,
err
)
}
if
err
:=
plugin
.
Network
Status
();
err
!=
nil
{
if
err
:=
plugin
.
Status
();
err
!=
nil
{
return
fmt
.
Errorf
(
"Kubenet cannot SetUpPod: %v"
,
err
)
}
...
...
@@ -294,7 +294,7 @@ func (plugin *kubenetNetworkPlugin) TearDownPod(namespace string, name string, i
// TODO: Use the addToNetwork function to obtain the IP of the Pod. That will assume idempotent ADD call to the plugin.
// Also fix the runtime's call to Status function to be done only in the case that the IP is lost, no need to do periodic calls
func
(
plugin
*
kubenetNetworkPlugin
)
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
func
(
plugin
*
kubenetNetworkPlugin
)
GetPodNetwork
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
plugin
.
mu
.
Lock
()
defer
plugin
.
mu
.
Unlock
()
cidr
,
ok
:=
plugin
.
podCIDRs
[
id
]
...
...
@@ -309,7 +309,7 @@ func (plugin *kubenetNetworkPlugin) Status(namespace string, name string, id kub
return
&
network
.
PodNetworkStatus
{
IP
:
ip
},
nil
}
func
(
plugin
*
kubenetNetworkPlugin
)
Network
Status
()
error
{
func
(
plugin
*
kubenetNetworkPlugin
)
Status
()
error
{
// Can't set up pods if we don't have a PodCIDR yet
if
plugin
.
netConfig
==
nil
{
return
fmt
.
Errorf
(
"Kubenet does not have netConfig. This is most likely due to lack of PodCIDR"
)
...
...
pkg/kubelet/network/kubenet/kubenet_unsupported.go
View file @
04b80f7f
...
...
@@ -49,6 +49,6 @@ func (plugin *kubenetNetworkPlugin) TearDownPod(namespace string, name string, i
return
fmt
.
Errorf
(
"Kubenet is not supported in this build"
)
}
func
(
plugin
*
kubenetNetworkPlugin
)
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
func
(
plugin
*
kubenetNetworkPlugin
)
GetPodNetwork
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
network
.
PodNetworkStatus
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"Kubenet is not supported in this build"
)
}
pkg/kubelet/network/plugins.go
View file @
04b80f7f
...
...
@@ -73,10 +73,10 @@ type NetworkPlugin interface {
TearDownPod
(
namespace
string
,
name
string
,
podInfraContainerID
kubecontainer
.
ContainerID
)
error
// Status is the method called to obtain the ipv4 or ipv6 addresses of the container
Status
(
namespace
string
,
name
string
,
podInfraContainerID
kubecontainer
.
ContainerID
)
(
*
PodNetworkStatus
,
error
)
GetPodNetwork
Status
(
namespace
string
,
name
string
,
podInfraContainerID
kubecontainer
.
ContainerID
)
(
*
PodNetworkStatus
,
error
)
// NetworkStatus returns error if the network plugin is in error state
Network
Status
()
error
Status
()
error
}
// PodNetworkStatus stores the network status of a pod (currently just the primary IP address)
...
...
@@ -191,10 +191,10 @@ func (plugin *NoopNetworkPlugin) TearDownPod(namespace string, name string, id k
return
nil
}
func
(
plugin
*
NoopNetworkPlugin
)
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
PodNetworkStatus
,
error
)
{
func
(
plugin
*
NoopNetworkPlugin
)
GetPodNetwork
Status
(
namespace
string
,
name
string
,
id
kubecontainer
.
ContainerID
)
(
*
PodNetworkStatus
,
error
)
{
return
nil
,
nil
}
func
(
plugin
*
NoopNetworkPlugin
)
Network
Status
()
error
{
func
(
plugin
*
NoopNetworkPlugin
)
Status
()
error
{
return
nil
}
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