Skip to content
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

Add pod disruption conditions for kubelet-initiated failures #112360

Merged

Conversation

mimowo
Copy link
Contributor

@mimowo mimowo commented Sep 9, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Special notes for your reviewer:

We limit this PR to cover a subset of pod failure scenarios described in the KEP. In particular, the following scenarios are excluded:

This is due to the following complications:

  • admission failures are non-retriable as all nodes in a cluster would have the same configuration, resulting in admission failures. A dedicated pod condition AdmissionFailures can be considered the future.
  • ResourceExhausted pod condition, based on OOM killer might be unreliable in some environments, because:
    • OOM killer may potentially kill a container which does not exceed the memory limits
    • on some environments (CRI-O with cgroupsv2) the reason field for the oom killed container is set as Error rather than the expected OOMKilled.

The KEP will be updated to reflect the decisions made during implementation phase for Beta: kubernetes/enhancements#3646

Does this PR introduce a user-facing change?

Kubelet adds the following pod failure conditions:
- DisruptionTarget (graceful node shutdown, node pressure eviction)

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3329-retriable-and-non-retriable-failures 

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 9, 2022
@k8s-ci-robot
Copy link
Contributor

@mimowo: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 9, 2022
@mimowo mimowo force-pushed the handling-pod-failures-beta-kubelet branch 2 times, most recently from c870a7a to 1658d03 Compare September 12, 2022 07:36
@mimowo mimowo force-pushed the handling-pod-failures-beta-kubelet branch from 1658d03 to e994b27 Compare September 30, 2022 13:47
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Sep 30, 2022
@fedebongio
Copy link
Contributor

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Oct 4, 2022
@mimowo mimowo force-pushed the handling-pod-failures-beta-kubelet branch from e994b27 to f3310f9 Compare October 10, 2022 11:58
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Oct 10, 2022
@mimowo
Copy link
Contributor Author

mimowo commented Oct 10, 2022

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 10, 2022
@mimowo mimowo force-pushed the handling-pod-failures-beta-kubelet branch from b8b2ba4 to 1e2b674 Compare October 11, 2022 08:24
@mimowo mimowo force-pushed the handling-pod-failures-beta-kubelet branch 2 times, most recently from eb3b989 to 07365e4 Compare November 7, 2022 07:46
@mimowo mimowo force-pushed the handling-pod-failures-beta-kubelet branch 4 times, most recently from 2158b29 to e1c146f Compare November 7, 2022 14:27
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 7, 2022
@mimowo
Copy link
Contributor Author

mimowo commented Nov 7, 2022

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Nov 7, 2022

@mimowo: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-node-kubelet-serial-crio-cgroupv1 193210fe945f9e9f531602887e5078a6590971fb link false /test pull-kubernetes-node-kubelet-serial-crio-cgroupv1

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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/test-infra repository. I understand the commands that are listed here.

@mimowo mimowo force-pushed the handling-pod-failures-beta-kubelet branch from e1c146f to 4e732e2 Compare November 7, 2022 15:22
@alculquicondor
Copy link
Member

Update to pkg/controller LGTM

// there might still be running containers to avoid sending an unnecessary PATCH request if the
// actual transition is delayed (see below)
if transitioningToTerminalPhase && !couldHaveRunningContainers {
// update the LastTransitionTime
Copy link
Member

@bobbypage bobbypage Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider to note that the reason of why we need to update LastTransitionTime for this condition again here is because the older transition time set in updateStatusInternal is likely stale because the status update was not sent until the all the containers have terminated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment in the follow up PR: #113718

pkg/kubelet/types/pod_status.go Show resolved Hide resolved
for _, c := range newPodStatus.Conditions {
if kubetypes.PodConditionByKubelet(c.Type) {
podConditions = append(podConditions, c)
} else if kubetypes.PodConditionSharedByKubelet(c.Type) {
Copy link
Member

@bobbypage bobbypage Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the logic like this -- this is much cleaner than the previous approach of "reverting" the condition.

The logic now is: we replace/append all the "shared kubelet" conditions, and guard the AlphaNoCompatGuaranteeDisruptionTarget condition with transitioningToTerminalPhase && !couldHaveRunningContainers to ensure it will only be sent once all containers have terminated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for point this out with the details.

nit: Can we include above the logic as the comment for future maintainence?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment in the follow up PR: #113718

@bobbypage
Copy link
Member

bobbypage commented Nov 7, 2022

Thanks for all the updates and refactoring the status updates in status manager, the updated logic is much more clear.

LGTM from me for SIG node related areas for pkg/kubelet/ and test/e2e_node/

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 7, 2022
@dchen1107
Copy link
Member

dchen1107 commented Nov 7, 2022

/lgtm
/approve from SIG Node

You can send the followup PR for the nits.

@liggitt
Copy link
Member

liggitt commented Nov 7, 2022

/approve

for API constant and doc change

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dchen1107, liggitt, mimowo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 7, 2022
@k8s-ci-robot k8s-ci-robot merged commit 47952e0 into kubernetes:master Nov 8, 2022
SIG Node CI/Test Board automation moved this from Archive-it to Done Nov 8, 2022
SIG Node PR Triage automation moved this from Triage to Done Nov 8, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Nov 8, 2022
@mimowo mimowo deleted the handling-pod-failures-beta-kubelet branch March 18, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/kubelet area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Status: API review completed, 1.26
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

10 participants