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
b57fbee5
Commit
b57fbee5
authored
May 19, 2016
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check pid in oomscoreadj
parent
e3e1c7a6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
18 deletions
+6
-18
manager.go
pkg/kubelet/dockertools/manager.go
+6
-18
No files found.
pkg/kubelet/dockertools/manager.go
View file @
b57fbee5
...
@@ -1413,6 +1413,12 @@ func containerAndPodFromLabels(inspect *dockertypes.ContainerJSON) (pod *api.Pod
...
@@ -1413,6 +1413,12 @@ func containerAndPodFromLabels(inspect *dockertypes.ContainerJSON) (pod *api.Pod
}
}
func
(
dm
*
DockerManager
)
applyOOMScoreAdj
(
container
*
api
.
Container
,
containerInfo
*
dockertypes
.
ContainerJSON
)
error
{
func
(
dm
*
DockerManager
)
applyOOMScoreAdj
(
container
*
api
.
Container
,
containerInfo
*
dockertypes
.
ContainerJSON
)
error
{
if
containerInfo
.
State
.
Pid
==
0
{
// Container exited. We cannot do anything about it. Ignore this error.
glog
.
V
(
2
)
.
Infof
(
"Failed to apply OOM score adj on container %q with ID %q. Init process does not exist."
,
containerInfo
.
Name
,
containerInfo
.
ID
)
return
nil
}
cgroupName
,
err
:=
dm
.
procFs
.
GetFullContainerName
(
containerInfo
.
State
.
Pid
)
cgroupName
,
err
:=
dm
.
procFs
.
GetFullContainerName
(
containerInfo
.
State
.
Pid
)
if
err
!=
nil
{
if
err
!=
nil
{
if
err
==
os
.
ErrNotExist
{
if
err
==
os
.
ErrNotExist
{
...
@@ -1495,24 +1501,6 @@ func (dm *DockerManager) runContainerInPod(pod *api.Pod, container *api.Containe
...
@@ -1495,24 +1501,6 @@ func (dm *DockerManager) runContainerInPod(pod *api.Pod, container *api.Containe
return
kubecontainer
.
ContainerID
{},
fmt
.
Errorf
(
"InspectContainer: %v"
,
err
)
return
kubecontainer
.
ContainerID
{},
fmt
.
Errorf
(
"InspectContainer: %v"
,
err
)
}
}
if
!
containerInfo
.
State
.
Running
{
if
container
.
Name
==
PodInfraContainerName
{
// If the infra container exited prematurely, return an error to raise
// awareness.
return
id
,
fmt
.
Errorf
(
"Infra container %q exited prematruely"
,
id
)
}
// For a user container, simply returns since we cannot apply oom score
// anymore.
glog
.
V
(
4
)
.
Info
(
"Container %q already exited"
,
containerInfo
.
ID
)
return
id
,
nil
}
// Ensure the PID actually exists, else we'll move ourselves.
// TODO: Should we simply log the error (or send an event) and move on? We
// don't check the oom score in the next sync and correct it anyway.
if
containerInfo
.
State
.
Pid
==
0
{
return
kubecontainer
.
ContainerID
{},
fmt
.
Errorf
(
"can't get init PID for container %q"
,
id
)
}
// Check if current docker version is higher than 1.10. Otherwise, we have to apply OOMScoreAdj instead of using docker API.
// Check if current docker version is higher than 1.10. Otherwise, we have to apply OOMScoreAdj instead of using docker API.
// TODO: Remove this logic after we stop supporting docker version < 1.10.
// TODO: Remove this logic after we stop supporting docker version < 1.10.
if
err
:=
dm
.
applyOOMScoreAdjIfNeeded
(
container
,
containerInfo
);
err
!=
nil
{
if
err
:=
dm
.
applyOOMScoreAdjIfNeeded
(
container
,
containerInfo
);
err
!=
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