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
8964469e
Commit
8964469e
authored
Feb 09, 2016
by
Yifan Gu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rkt: Remove ShouldContainerBeRestartedOldVersion().
parent
f93d9304
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
29 deletions
+1
-29
helpers.go
pkg/kubelet/container/helpers.go
+0
-28
rkt.go
pkg/kubelet/rkt/rkt.go
+1
-1
No files found.
pkg/kubelet/container/helpers.go
View file @
8964469e
...
...
@@ -72,34 +72,6 @@ func ShouldContainerBeRestarted(container *api.Container, pod *api.Pod, podStatu
return
true
}
// TODO(random-liu): This should be removed soon after rkt implements GetPodStatus.
func
ShouldContainerBeRestartedOldVersion
(
container
*
api
.
Container
,
pod
*
api
.
Pod
,
podStatus
*
api
.
PodStatus
)
bool
{
// Get all dead container status.
var
resultStatus
[]
*
api
.
ContainerStatus
for
i
,
containerStatus
:=
range
podStatus
.
ContainerStatuses
{
if
containerStatus
.
Name
==
container
.
Name
&&
containerStatus
.
State
.
Terminated
!=
nil
{
resultStatus
=
append
(
resultStatus
,
&
podStatus
.
ContainerStatuses
[
i
])
}
}
// Check RestartPolicy for dead container.
if
len
(
resultStatus
)
>
0
{
if
pod
.
Spec
.
RestartPolicy
==
api
.
RestartPolicyNever
{
glog
.
V
(
4
)
.
Infof
(
"Already ran container %q of pod %q, do nothing"
,
container
.
Name
,
format
.
Pod
(
pod
))
return
false
}
if
pod
.
Spec
.
RestartPolicy
==
api
.
RestartPolicyOnFailure
{
// Check the exit code of last run. Note: This assumes the result is sorted
// by the created time in reverse order.
if
resultStatus
[
0
]
.
State
.
Terminated
.
ExitCode
==
0
{
glog
.
V
(
4
)
.
Infof
(
"Already successfully ran container %q of pod %q, do nothing"
,
container
.
Name
,
format
.
Pod
(
pod
))
return
false
}
}
}
return
true
}
// TODO(random-liu): Convert PodStatus to running Pod, should be deprecated soon
func
ConvertPodStatusToRunningPod
(
podStatus
*
PodStatus
)
Pod
{
runningPod
:=
Pod
{
...
...
pkg/kubelet/rkt/rkt.go
View file @
8964469e
...
...
@@ -1088,7 +1088,7 @@ func (r *Runtime) SyncPod(pod *api.Pod, podStatus api.PodStatus, internalPodStat
c
:=
runningPod
.
FindContainerByName
(
container
.
Name
)
if
c
==
nil
{
if
kubecontainer
.
ShouldContainerBeRestarted
OldVersion
(
&
container
,
pod
,
&
p
odStatus
)
{
if
kubecontainer
.
ShouldContainerBeRestarted
(
&
container
,
pod
,
internalP
odStatus
)
{
glog
.
V
(
3
)
.
Infof
(
"Container %+v is dead, but RestartPolicy says that we should restart it."
,
container
)
// TODO(yifan): Containers in one pod are fate-sharing at this moment, see:
// https://github.com/appc/spec/issues/276.
...
...
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