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
Ensure terminal pods maintain terminal status #105462
Conversation
/test pull-kubernetes-node-kubelet-eviction |
728f146
to
e8b99f4
Compare
@@ -622,6 +622,64 @@ func TestTerminatePod(t *testing.T) { | |||
assert.Equal(t, newStatus.Message, firstStatus.Message) | |||
} | |||
|
|||
func TestTerminatePodWaiting(t *testing.T) { |
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.
Basically copied from test above, but changed (init)container 3 to waiting status
e8b99f4
to
77b4cb0
Compare
77b4cb0
to
c32e569
Compare
/triage accepted |
/retest-required |
The node got a DELETE before it even started to spin up the pod... looks like it wasn't able to sync out the final status due to client-side throttling:
This just seems like accidental bad timing to me and unrelated to the PR... thoughts? Attached: |
- Update test to account for late synced statuses - Terminated containers are not running - Add missing format values to test logline
2cb2ae6
to
f9a827b
Compare
@@ -425,7 +427,7 @@ var _ = SIGDescribe("Pods Extended", func() { | |||
if !hasTerminalPhase { | |||
var names []string | |||
for _, status := range pod.Status.ContainerStatuses { | |||
if status.State.Terminated != nil || status.State.Running != nil { | |||
if status.State.Running != nil { |
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 this was just wrong before, but we never hit it because we were failing to sync out terminated container statuses. Now that we're doing that correctly, a Pending pod with a terminated container (perhaps because it was deleted before it reached Running) would cause this test to fail.
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.
Note: this line came from #88440 which explicitly says in the description "The kubelet will consider any container without the waiting
or terminated
state to be still running, like it does for other operations." which doesn't match the code here.
/test pull-kubernetes-node-kubelet-eviction |
Passed tests 🥳 The serial tests will fail, just wanna take a quick look for signal. |
Are there any other optional jobs we should run? |
Don't think so. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ehashman, smarterclayton 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 |
…5462-upstream-release-1.22 Automated cherry pick of #105462: Ensure terminal pods maintain terminal status
Alternative to #105411. This is a slightly tighter patch and appears to also fix the issue.
What type of PR is this?
/kind bug
/sig node
/priority critical-urgent
What this PR does / why we need it:
Avoids overwriting statuses or phase on terminated pods.
Which issue(s) this PR fixes:
Fixes #105358
Special notes for your reviewer
This avoids an
isTerminated
check, which we may not need. We can fix the container restart count issue separately.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: