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
Wait for container cleanup before deletion #50350
Wait for container cleanup before deletion #50350
Conversation
/release-note-none |
cc @kubernetes/sig-node-pr-reviews |
/assign @dchen1107 |
pkg/kubelet/kubelet_pods.go
Outdated
@@ -741,6 +742,22 @@ func (kl *Kubelet) podIsTerminated(pod *v1.Pod) bool { | |||
return status.Phase == v1.PodFailed || status.Phase == v1.PodSucceeded || (pod.DeletionTimestamp != nil && notRunning(status.ContainerStatuses)) | |||
} | |||
|
|||
// podIsDeleted returns true if the pod is deleted. For the pod to be deleted, either: |
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.
nits: IsPodDeleted ...
1d9e92a
to
a3e39b0
Compare
/retest |
/lgtm |
/lgtm |
/retest |
a3e39b0
to
2938018
Compare
/test pull-kubernetes-e2e-kops-aws |
lgtm removed because of rebase. This should be in the 1.8 milestone |
cc: @kubernetes/kubernetes-release-managers |
/retest Review the full test history for this PR. |
1 similar comment
/retest Review the full test history for this PR. |
2938018
to
9ac30e2
Compare
rebased |
/retest |
1 similar comment
/retest |
re-applying lgtm after rebase, originally lgtm was from @dchen1107 |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dashpole, dchen1107, vishh Associated issue: 50268 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest Review the full test history for this PR. |
Automatic merge from submit-queue (batch tested with PRs 51186, 50350, 51751, 51645, 51837) |
@dashpole: The following test failed, say
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. |
Automatic merge from submit-queue (batch tested with PRs 16889, 16865). UPSTREAM: 53857: kubelet sync pod throws more detailed events Also includes the following upstream dependant PRs: UPSTREAM: 50350: Wait for container cleanup before deletion UPSTREAM: 48970: Recreate pod sandbox when the sandbox does not have an IP address. UPSTREAM: 48589: When faild create pod sandbox record event. UPSTREAM: 48584: Move event type UPSTREAM: 47599: Rerun init containers when the pod needs to be restarted xrefs: kubernetes/kubernetes#53857 kubernetes/kubernetes#50350 kubernetes/kubernetes#48970 kubernetes/kubernetes#48589 kubernetes/kubernetes#48584 kubernetes/kubernetes#47599
We should wait to delete pod API objects until the pod's containers have been cleaned up. See issue: #50268 for background.
This changes the kubelet container gc, which deletes containers belonging to pods considered "deleted".
It adds two conditions under which a pod is considered "deleted", allowing containers to be deleted:
Pods where deletionTimestamp is set, and containers are not running
Pods that are evicted
This PR also changes the function PodResourcesAreReclaimed by making it return false if containers still exist.
The eviction manager will wait for containers of previous evicted pod to be deleted before evicting another pod.
The status manager will wait for containers to be deleted before removing the pod API object.
/assign @vishh