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
1f3e47f6
Commit
1f3e47f6
authored
Apr 17, 2015
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7005 from yifan-gu/kube_dep
kubelet: Refactor shouldContainerBeRestarted():
parents
f6238fa6
29a5da23
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
kubelet.go
pkg/kubelet/kubelet.go
+3
-3
No files found.
pkg/kubelet/kubelet.go
View file @
1f3e47f6
...
...
@@ -982,7 +982,7 @@ func (kl *Kubelet) makePodDataDirs(pod *api.Pod) error {
return
nil
}
func
(
kl
*
Kubelet
)
shouldContainerBeRestarted
(
container
*
api
.
Container
,
pod
*
api
.
Pod
,
podStatus
*
api
.
PodStatus
)
bool
{
func
shouldContainerBeRestarted
(
container
*
api
.
Container
,
pod
*
api
.
Pod
,
podStatus
*
api
.
PodStatus
,
readinessManager
*
kubecontainer
.
ReadinessManager
)
bool
{
podFullName
:=
kubecontainer
.
GetPodFullName
(
pod
)
// Get all dead container status.
...
...
@@ -996,7 +996,7 @@ func (kl *Kubelet) shouldContainerBeRestarted(container *api.Container, pod *api
// Set dead containers to unready state.
for
_
,
c
:=
range
resultStatus
{
// TODO(yifan): Unify the format of container ID. (i.e. including docker:// as prefix).
kl
.
readinessManager
.
RemoveReadiness
(
strings
.
TrimPrefix
(
c
.
ContainerID
,
dockertools
.
DockerPrefix
))
readinessManager
.
RemoveReadiness
(
strings
.
TrimPrefix
(
c
.
ContainerID
,
dockertools
.
DockerPrefix
))
}
// Check RestartPolicy for dead container.
...
...
@@ -1124,7 +1124,7 @@ func (kl *Kubelet) computePodContainerChanges(pod *api.Pod, runningPod kubeconta
c
:=
runningPod
.
FindContainerByName
(
container
.
Name
)
if
c
==
nil
{
if
kl
.
shouldContainerBeRestarted
(
&
container
,
pod
,
&
podStatus
)
{
if
shouldContainerBeRestarted
(
&
container
,
pod
,
&
podStatus
,
kl
.
readinessManager
)
{
// If we are here it means that the container is dead and should be restarted, or never existed and should
// be created. We may be inserting this ID again if the container has changed and it has
// RestartPolicy::Always, but it's not a big deal.
...
...
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