Skip to content

Commit ba886ba

Browse files
committed
Check restartCount of all containers
Signed-off-by: kerthcet <[email protected]>
1 parent c52de33 commit ba886ba

File tree

1 file changed

+8
-8
lines changed
  • keps/sig-node/3322-add-maxRestartTimes-to-podSpec

1 file changed

+8
-8
lines changed

keps/sig-node/3322-add-maxRestartTimes-to-podSpec/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ updates.
173173
[documentation style guide]: https://github.com/kubernetes/community/blob/master/contributors/guide/style-guide.md
174174
-->
175175
This KEP aims to add a new field named `maxRestartTimes`(TBD) to podSpec which helps controlling
176-
the restart times of a container when pod's `restartPolicy` is set to `OnFailure`.
176+
the restart times of a Pod when Pod's `restartPolicy` is set to `OnFailure`.
177177

178178
## Motivation
179179

@@ -220,8 +220,8 @@ The "Design Details" section below is for the real
220220
nitty-gritty.
221221
-->
222222
Add a new field `maxRestartTimes` to the spec of pod. `maxRestartTimes` only applies
223-
when `restartPolicy` is set to `OnFailure`. As a result, every container of
224-
the pod has the limit restart times defined by `maxRestartTimes`.
223+
when `restartPolicy` is set to `OnFailure`. As a result, the restart times of a Pod
224+
will be controlled by `maxRestartTimes`.
225225

226226

227227
### User Stories (Optional)
@@ -278,11 +278,11 @@ proposal will be implemented, this is the place to discuss them.
278278
If Pod's `RestartPolicy` is `Always` or `Never`, `MaxRestartTimes` is default to -1, and will not apply.
279279

280280
If Pod's `RestartPolicy` is `OnFailure`, `MaxRestartTimes` is also default to -1, which means infinite
281-
restart times for backwards compatibility. In runtime, we'll check the `RestartCount` of
282-
container [`Status`](https://github.com/kubernetes/kubernetes/blob/451e1fa8bcff38b87504eebd414948e505526d01/pkg/kubelet/container/runtime.go#L306-L335)
283-
in function [`ShouldContainerBeRestarted`](https://github.com/kubernetes/kubernetes/blob/451e1fa8bcff38b87504eebd414948e505526d01/pkg/kubelet/container/helpers.go#L63-L96).
284-
If restart count is greater than the `MaxRestartTimes`, return false indicating the container should not
285-
restart again. We'll add a new error named `ExceedMaxRestartTimes` as the reason of Pod's failure state.
281+
restart times for backwards compatibility. In runtime, we'll check the sum of `RestartCount` of
282+
all containers [`Status`](https://github.com/kubernetes/kubernetes/blob/451e1fa8bcff38b87504eebd414948e505526d01/pkg/kubelet/container/runtime.go#L306-L335)
283+
packaged by Pod in function [`ShouldContainerBeRestarted`](https://github.com/kubernetes/kubernetes/blob/451e1fa8bcff38b87504eebd414948e505526d01/pkg/kubelet/container/helpers.go#L63-L96).
284+
If the value is greater than the `MaxRestartTimes`, return false indicating the Pod should not restart again.
285+
We'll add a new error named `ExceedMaxRestartTimes` as the reason of Pod's failure state.
286286

287287

288288
### Test Plan

0 commit comments

Comments
 (0)