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
7b4cdb6f
Commit
7b4cdb6f
authored
Jan 26, 2016
by
Random-Liu
Committed by
Lantao Liu
Feb 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove GetAPIPodStatus from runtime interface
parent
41b12a18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
5 additions
and
44 deletions
+5
-44
fake_runtime.go
pkg/kubelet/container/fake_runtime.go
+0
-9
runtime.go
pkg/kubelet/container/runtime.go
+0
-5
runtime_mock.go
pkg/kubelet/container/runtime_mock.go
+0
-5
fake_docker_client.go
pkg/kubelet/dockertools/fake_docker_client.go
+2
-2
manager.go
pkg/kubelet/dockertools/manager.go
+1
-13
manager_test.go
pkg/kubelet/dockertools/manager_test.go
+0
-0
kubelet_test.go
pkg/kubelet/kubelet_test.go
+2
-0
rkt.go
pkg/kubelet/rkt/rkt.go
+0
-10
No files found.
pkg/kubelet/container/fake_runtime.go
View file @
7b4cdb6f
...
@@ -236,15 +236,6 @@ func (f *FakeRuntime) KillContainerInPod(container api.Container, pod *api.Pod)
...
@@ -236,15 +236,6 @@ func (f *FakeRuntime) KillContainerInPod(container api.Container, pod *api.Pod)
return
f
.
Err
return
f
.
Err
}
}
func
(
f
*
FakeRuntime
)
GetAPIPodStatus
(
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
f
.
Lock
()
defer
f
.
Unlock
()
f
.
CalledFunctions
=
append
(
f
.
CalledFunctions
,
"GetAPIPodStatus"
)
status
:=
f
.
APIPodStatus
return
&
status
,
f
.
Err
}
func
(
f
*
FakeRuntime
)
GetPodStatus
(
uid
types
.
UID
,
name
,
namespace
string
)
(
*
PodStatus
,
error
)
{
func
(
f
*
FakeRuntime
)
GetPodStatus
(
uid
types
.
UID
,
name
,
namespace
string
)
(
*
PodStatus
,
error
)
{
f
.
Lock
()
f
.
Lock
()
defer
f
.
Unlock
()
defer
f
.
Unlock
()
...
...
pkg/kubelet/container/runtime.go
View file @
7b4cdb6f
...
@@ -69,11 +69,6 @@ type Runtime interface {
...
@@ -69,11 +69,6 @@ type Runtime interface {
// KillPod kills all the containers of a pod. Pod may be nil, running pod must not be.
// KillPod kills all the containers of a pod. Pod may be nil, running pod must not be.
// TODO(random-liu): Return PodSyncResult in KillPod.
// TODO(random-liu): Return PodSyncResult in KillPod.
KillPod
(
pod
*
api
.
Pod
,
runningPod
Pod
)
error
KillPod
(
pod
*
api
.
Pod
,
runningPod
Pod
)
error
// GetAPIPodStatus retrieves the api.PodStatus of the pod, including the information of
// all containers in the pod. Clients of this interface assume the
// containers' statuses in a pod always have a deterministic ordering
// (e.g., sorted by name).
GetAPIPodStatus
(
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
// GetPodStatus retrieves the status of the pod, including the
// GetPodStatus retrieves the status of the pod, including the
// information of all containers in the pod that are visble in Runtime.
// information of all containers in the pod that are visble in Runtime.
GetPodStatus
(
uid
types
.
UID
,
name
,
namespace
string
)
(
*
PodStatus
,
error
)
GetPodStatus
(
uid
types
.
UID
,
name
,
namespace
string
)
(
*
PodStatus
,
error
)
...
...
pkg/kubelet/container/runtime_mock.go
View file @
7b4cdb6f
...
@@ -77,11 +77,6 @@ func (r *Mock) KillContainerInPod(container api.Container, pod *api.Pod) error {
...
@@ -77,11 +77,6 @@ func (r *Mock) KillContainerInPod(container api.Container, pod *api.Pod) error {
return
args
.
Error
(
0
)
return
args
.
Error
(
0
)
}
}
func
(
r
*
Mock
)
GetAPIPodStatus
(
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
args
:=
r
.
Called
(
pod
)
return
args
.
Get
(
0
)
.
(
*
api
.
PodStatus
),
args
.
Error
(
1
)
}
func
(
r
*
Mock
)
GetPodStatus
(
uid
types
.
UID
,
name
,
namespace
string
)
(
*
PodStatus
,
error
)
{
func
(
r
*
Mock
)
GetPodStatus
(
uid
types
.
UID
,
name
,
namespace
string
)
(
*
PodStatus
,
error
)
{
args
:=
r
.
Called
(
uid
,
name
,
namespace
)
args
:=
r
.
Called
(
uid
,
name
,
namespace
)
return
args
.
Get
(
0
)
.
(
*
PodStatus
),
args
.
Error
(
1
)
return
args
.
Get
(
0
)
.
(
*
PodStatus
),
args
.
Error
(
1
)
...
...
pkg/kubelet/dockertools/fake_docker_client.go
View file @
7b4cdb6f
...
@@ -250,7 +250,7 @@ func (f *FakeDockerClient) CreateContainer(c docker.CreateContainerOptions) (*do
...
@@ -250,7 +250,7 @@ func (f *FakeDockerClient) CreateContainer(c docker.CreateContainerOptions) (*do
// Docker likes to add a '/', so copy that behavior.
// Docker likes to add a '/', so copy that behavior.
name
:=
"/"
+
c
.
Name
name
:=
"/"
+
c
.
Name
f
.
Created
=
append
(
f
.
Created
,
name
)
f
.
Created
=
append
(
f
.
Created
,
name
)
// The newest container should be in front, because we assume so in Get
API
PodStatus()
// The newest container should be in front, because we assume so in GetPodStatus()
f
.
ContainerList
=
append
([]
docker
.
APIContainers
{
f
.
ContainerList
=
append
([]
docker
.
APIContainers
{
{
ID
:
name
,
Names
:
[]
string
{
name
},
Image
:
c
.
Config
.
Image
,
Labels
:
c
.
Config
.
Labels
},
{
ID
:
name
,
Names
:
[]
string
{
name
},
Image
:
c
.
Config
.
Image
,
Labels
:
c
.
Config
.
Labels
},
},
f
.
ContainerList
...
)
},
f
.
ContainerList
...
)
...
@@ -300,7 +300,7 @@ func (f *FakeDockerClient) StopContainer(id string, timeout uint) error {
...
@@ -300,7 +300,7 @@ func (f *FakeDockerClient) StopContainer(id string, timeout uint) error {
var
newList
[]
docker
.
APIContainers
var
newList
[]
docker
.
APIContainers
for
_
,
container
:=
range
f
.
ContainerList
{
for
_
,
container
:=
range
f
.
ContainerList
{
if
container
.
ID
==
id
{
if
container
.
ID
==
id
{
// The newest exited container should be in front. Because we assume so in Get
API
PodStatus()
// The newest exited container should be in front. Because we assume so in GetPodStatus()
f
.
ExitedContainerList
=
append
([]
docker
.
APIContainers
{
container
},
f
.
ExitedContainerList
...
)
f
.
ExitedContainerList
=
append
([]
docker
.
APIContainers
{
container
},
f
.
ExitedContainerList
...
)
continue
continue
}
}
...
...
pkg/kubelet/dockertools/manager.go
View file @
7b4cdb6f
...
@@ -104,8 +104,7 @@ type DockerManager struct {
...
@@ -104,8 +104,7 @@ type DockerManager struct {
// means that some entries may be recycled before a pod has been
// means that some entries may be recycled before a pod has been
// deleted.
// deleted.
reasonCache
reasonInfoCache
reasonCache
reasonInfoCache
// TODO(yifan): Record the pull failure so we can eliminate the image checking
// TODO(yifan): Record the pull failure so we can eliminate the image checking?
// in GetAPIPodStatus()?
// Lower level docker image puller.
// Lower level docker image puller.
dockerPuller
DockerPuller
dockerPuller
DockerPuller
...
@@ -419,17 +418,6 @@ func (dm *DockerManager) inspectContainer(id string, podName, podNamespace strin
...
@@ -419,17 +418,6 @@ func (dm *DockerManager) inspectContainer(id string, podName, podNamespace strin
return
&
status
,
""
,
nil
return
&
status
,
""
,
nil
}
}
// GetAPIPodStatus returns docker related status for all containers in the pod
// spec.
func
(
dm
*
DockerManager
)
GetAPIPodStatus
(
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
// Get the pod status.
podStatus
,
err
:=
dm
.
GetPodStatus
(
pod
.
UID
,
pod
.
Name
,
pod
.
Namespace
)
if
err
!=
nil
{
return
nil
,
err
}
return
dm
.
ConvertPodStatusToAPIPodStatus
(
pod
,
podStatus
)
}
func
(
dm
*
DockerManager
)
ConvertPodStatusToAPIPodStatus
(
pod
*
api
.
Pod
,
podStatus
*
kubecontainer
.
PodStatus
)
(
*
api
.
PodStatus
,
error
)
{
func
(
dm
*
DockerManager
)
ConvertPodStatusToAPIPodStatus
(
pod
*
api
.
Pod
,
podStatus
*
kubecontainer
.
PodStatus
)
(
*
api
.
PodStatus
,
error
)
{
var
apiPodStatus
api
.
PodStatus
var
apiPodStatus
api
.
PodStatus
uid
:=
pod
.
UID
uid
:=
pod
.
UID
...
...
pkg/kubelet/dockertools/manager_test.go
View file @
7b4cdb6f
This diff is collapsed.
Click to expand it.
pkg/kubelet/kubelet_test.go
View file @
7b4cdb6f
...
@@ -4348,3 +4348,5 @@ func TestGetPodsToSync(t *testing.T) {
...
@@ -4348,3 +4348,5 @@ func TestGetPodsToSync(t *testing.T) {
t
.
Errorf
(
"expected %d pods to sync, got %d"
,
3
,
len
(
podsToSync
))
t
.
Errorf
(
"expected %d pods to sync, got %d"
,
3
,
len
(
podsToSync
))
}
}
}
}
// TODO(random-liu): Add unit test for convertStatusToAPIStatus (issue #20478)
pkg/kubelet/rkt/rkt.go
View file @
7b4cdb6f
...
@@ -1009,16 +1009,6 @@ func (r *Runtime) KillPod(pod *api.Pod, runningPod kubecontainer.Pod) error {
...
@@ -1009,16 +1009,6 @@ func (r *Runtime) KillPod(pod *api.Pod, runningPod kubecontainer.Pod) error {
return
nil
return
nil
}
}
// GetAPIPodStatus returns the status of the given pod.
func
(
r
*
Runtime
)
GetAPIPodStatus
(
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
// Get the pod status.
podStatus
,
err
:=
r
.
GetPodStatus
(
pod
.
UID
,
pod
.
Name
,
pod
.
Namespace
)
if
err
!=
nil
{
return
nil
,
err
}
return
r
.
ConvertPodStatusToAPIPodStatus
(
pod
,
podStatus
)
}
func
(
r
*
Runtime
)
Type
()
string
{
func
(
r
*
Runtime
)
Type
()
string
{
return
RktType
return
RktType
}
}
...
...
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