Skip to content

Commit b2c9f56

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

File tree

1 file changed

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

1 file changed

+11
-9
lines changed

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

+11-9
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ tags, and then generate with `hack/update-toc.sh`.
8585
- [Proposal](#proposal)
8686
- [User Stories (Optional)](#user-stories-optional)
8787
- [Story 1](#story-1)
88-
- [Story 2](#story-2)
8988
- [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional)
9089
- [Risks and Mitigations](#risks-and-mitigations)
9190
- [Design Details](#design-details)
@@ -95,6 +94,9 @@ tags, and then generate with `hack/update-toc.sh`.
9594
- [Integration tests](#integration-tests)
9695
- [e2e tests](#e2e-tests)
9796
- [Graduation Criteria](#graduation-criteria)
97+
- [Alpha](#alpha)
98+
- [Beta](#beta)
99+
- [GA](#ga)
98100
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
99101
- [Version Skew Strategy](#version-skew-strategy)
100102
- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire)
@@ -173,7 +175,7 @@ updates.
173175
[documentation style guide]: https://github.com/kubernetes/community/blob/master/contributors/guide/style-guide.md
174176
-->
175177
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`.
178+
the restart times of a Pod when Pod's `restartPolicy` is set to `OnFailure`.
177179

178180
## Motivation
179181

@@ -220,8 +222,8 @@ The "Design Details" section below is for the real
220222
nitty-gritty.
221223
-->
222224
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`.
225+
when `restartPolicy` is set to `OnFailure`. As a result, the restart times of a Pod
226+
will be controlled by `maxRestartTimes`.
225227

226228

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

280282
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.
283+
restart times for backwards compatibility. In runtime, we'll check the sum of `RestartCount` of
284+
all containers [`Status`](https://github.com/kubernetes/kubernetes/blob/451e1fa8bcff38b87504eebd414948e505526d01/pkg/kubelet/container/runtime.go#L306-L335)
285+
packaged by Pod in function [`ShouldContainerBeRestarted`](https://github.com/kubernetes/kubernetes/blob/451e1fa8bcff38b87504eebd414948e505526d01/pkg/kubelet/container/helpers.go#L63-L96).
286+
If the value is greater than the `MaxRestartTimes`, return false indicating the Pod should not restart again.
287+
We'll add a new error named `ExceedMaxRestartTimes` as the reason of Pod's failure state.
286288

287289

288290
### Test Plan

0 commit comments

Comments
 (0)