-
Notifications
You must be signed in to change notification settings - Fork 40.9k
e2e node: Test probes during pod termination #127863
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
base: master
Are you sure you want to change the base?
Conversation
Hi @hshiina. 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hshiina 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 |
/remove-kind bug |
79dccff
to
6dbc51b
Compare
6dbc51b
to
85ee561
Compare
/ok-to-test |
In order to test probes during pod termination, this fix uses ActiveDeadlineSeconds to trigger the pod termination. A failing liveness probe is not available for this purpose because a container is stopped before pod termination.
In order to test probes during pod termination, this fix add test cases to delete a pod with probes to trigger the pod termination.
85ee561
to
eaef931
Compare
/remove-kind flake |
/assign @AnishShah |
/triage accepted |
@bart0sh: 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. |
/priority important-longterm |
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.
This PR adds two new triggering conditions to the existing test cases. However, running them takes too much time. For the "ActiveDeadlineSeconds expires" condition, we even need 110+ seconds to complete a single test case. I believe this is unnecessary in practice. You should try to minimize the waiting time to make the tests run faster :)
Name: regular1, | ||
Image: imageutils.GetE2EImage(imageutils.BusyBox), | ||
Command: ExecCommand(regular1, execCommand{ | ||
Delay: 100, |
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.
Does this mean the pod will stay in the Running state for 100 seconds? This test takes way too long.
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.
No, the pod termination is triggered in ActiveDeadlineSeconds(10s)
.
framework.ExpectNoError(err) | ||
|
||
// Sleep expecting thet the preStop wiil complete and the container will get into TerminationSeconds window. | ||
time.Sleep(25 * time.Second) |
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.
I think waiting for 25 seconds here is unnecessary. We can synchronize the reduction of the required time through TerminationSeconds and the PreStop hook, so that a single test case can run at a faster speed.
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.
Though I don't remember exactly why I chose these values, I might have tried to make this test pass with EventedPLEG against #124704 that causes delays at deletion.
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.
Name: regular1, | ||
Image: imageutils.GetE2EImage(imageutils.BusyBox), | ||
Command: ExecCommand(regular1, execCommand{ | ||
Delay: 100, |
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.
No, the pod termination is triggered in ActiveDeadlineSeconds(10s)
.
framework.ExpectNoError(err) | ||
|
||
// Sleep expecting thet the preStop wiil complete and the container will get into TerminationSeconds window. | ||
time.Sleep(25 * time.Second) |
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.
Though I don't remember exactly why I chose these values, I might have tried to make this test pass with EventedPLEG against #124704 that causes delays at deletion.
This is not related to this PR. I just want to see how this job currently works. |
This is not related to this PR. I just want to see how this job currently works. |
/test pull-kubernetes-e2e-gce-serial |
1 similar comment
/test pull-kubernetes-e2e-gce-serial |
/test pull-kubernetes-e2e-gce-serial-canary |
@hshiina: The following tests 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-sigs/prow repository. I understand the commands that are listed here. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
These test cases look to intend to verify probe behaviors while a pod is being terminated:
kubernetes/test/e2e_node/container_lifecycle_test.go
Line 756 in 7ab8a2b
In
SyncTerminatingPod()
, liveness probes are stopped before killing a pod while readiness probes are stopped after killing the pod:kubernetes/pkg/kubelet/kubelet.go
Lines 2024 to 2038 in c9a61af
The test cases are trying to test this code path with a failing liveness probe. However, when a liveness probe fails, the container is stopped at
SyncPod()
before the pod gets into termination phase even ifRestartPolicy
isNever
:kubernetes/pkg/kubelet/kubelet.go
Line 1963 in c9a61af
kubernetes/pkg/kubelet/kuberuntime/kuberuntime_manager.go
Lines 996 to 999 in c9a61af
So, both liveness probes and readiness probes can run while the preStop hook is running. The test case to see if the liveness probe is stopped passes just because the init container gets into
CrashLoopBackoff
. If the init container doesn’t get intoCrashLoopBackoff
, this test fails (#127312).In order to run the preStop hook in
SyncTerminatingPod()
, this PR adds test cases to terminate a pod withActiveDeadlineSeconds
.After this is fixed, there remains a problem. Due to #124648, all probes are stopped before killing a pod if pod termination is triggered by kubelet such as active deadline and eviction. We need to fix this issue.
Alternatively, we can test this code path with deleting a pod. This PR also adds test cases to delete a pod with probes.
By the way, liveness probes for init containers are not stopped before killing the pod when the pod is terminated by deletion because
StopLivenessAndStartup()
stops only probes of regular containers:kubernetes/pkg/kubelet/prober/prober_manager.go
Line 232 in 5ecd83f
Which issue(s) this PR fixes:
Fixes
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: