-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean up, use attempt from container runtime service as restart count #124707
base: master
Are you sure you want to change the base?
Conversation
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chengjoey The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @chengjoey. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/sig kubelet |
@chengjoey: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/triage accepted |
/cc |
34841b4
to
5c5e6cb
Compare
func (m *kubeGenericRuntimeManager) convertToKubeContainerStatus(status *runtimeapi.ContainerStatus) (cStatus *kubecontainer.Status) { | ||
cStatus = toKubeContainerStatus(status, m.runtimeName) | ||
annotatedInfo := getContainerInfoFromAnnotations(status.Annotations) | ||
cStatus = toKubeContainerStatus(status, m.runtimeName, annotatedInfo) | ||
if status.State == runtimeapi.ContainerState_CONTAINER_EXITED { | ||
// Populate the termination message if needed. | ||
annotatedInfo := getContainerInfoFromAnnotations(status.Annotations) | ||
// If a container cannot even be started, it certainly does not have logs, so no need to fallbackToLogs. | ||
fallbackToLogs := annotatedInfo.TerminationMessagePolicy == v1.TerminationMessageFallbackToLogsOnError && | ||
cStatus.ExitCode != 0 && cStatus.Reason != "ContainerCannotRun" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the original toKubeContainerStatus
function needs to parse annotatedInfo from status, and when status.State == runtimeapi.ContainerState_CONTAINER_EXITED
, it needs to parse annotatedInfo again, so passing annotatedInfo as a pointer to toKubeContainerStatus avoids parsing annotatedInfo twice.
5c5e6cb
to
3c20ab9
Compare
Signed-off-by: joey <zchengjoey@gmail.com>
3c20ab9
to
5e52da8
Compare
/test pull-kubernetes-e2e-gce |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
use attempt from container runtime service as restart count
don't need to parse the restartCount from the container's annotation, but directly obtain it from the status returned by the cri
kubernetes/pkg/kubelet/kuberuntime/kuberuntime_container.go
Lines 342 to 348 in 2c7bda5
Special notes for your reviewer: