-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Fix that PodIP field is temporarily removed for a terminal pod #125404
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
Conversation
/triage accepted |
cc @bobbypage |
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.
/lgtm
/cc @aojea
LGTM label has been added. Git tree hash: 87e79b63ca3f4f611a434e8cf4f88260d03e40ea
|
/hold waiting for review from @bobbypage - feel free to remove anytime |
/test pull-kubernetes-unit |
/approve LGTM but will let David or Sergey drive the final ack. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aojea, mimowo, 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 |
Thank you, so the remaining question is about cherry-pick. I'm not sure we have enough signal based on #125370 (comment). However, I would vote for it because:
|
@mimowo you may need to squash the commits for the backport LGTM , defer to @SergeyKanzhelev final lgtm I'm +1 on the backport because the fix is contained and there are a lot of informers that depend on PodIPs field, missing the field can lead to corner and complex cases |
66eccac
to
5f1ab75
Compare
Thanks! done |
/assign @SergeyKanzhelev @bobbypage |
/lgtm thank you! |
LGTM label has been added. Git tree hash: 678395c1479986fbbefeb59c1087a7a91c0fb5bc
|
Thank you! I have prepared the cherry-picks for review since 1.27 when the regression started, even though 1.27 is EOL currently. It probably does not hurt to cherry-pick there, otherwise I will just close that PR. |
…04-upstream-release-1.30 Automated cherry pick of #125404: Fix that PodIP field is not set for terminal pod
…04-upstream-release-1.29 Automated cherry pick of #125404: Fix that PodIP field is not set for terminal pod
…04-upstream-release-1.28 Automated cherry pick of #125404: Fix that PodIP field is not set for terminal pod
What type of PR is this?
/kind bug
/kind regression
What this PR does / why we need it:
Additionally, due to the bug there is one more unnecessary API call sent by Kubelet.
Which issue(s) this PR fixes:
Fixes #125370
Special notes for your reviewer:
Output to
> kubectl get pod -w -ocustom-columns=NAME:.metadata.name,PHASE:.status.phase,IP:.status.podIP | ts "%Y-%m-%d %H:%M:%.S"
:before:
after fix (note there is no extra API status update):
Note that the last status update in both cases is the removal of the Job finalizer.
Some questions potential questions based on my priv chats:
This is because the last status update is triggered by
syncTerminatedPod
which generates theapiPodStatus
based on thepodStatus
which is passed from the cache in pod_workers. In contrary, the status update triggered bysyncTerminating
pods was just based on the container runtimecontainerRuntime.GetPodStatus
.Because of the explicit check for SANDBOX_READY here
podStatus
cache contains the IP information whensyncTerminatedPod
is called. Because it gets updated inside updateCache. Note that, in that case we also fallback tooldPodStatus.IP
for stopped containers, see here.It seems not. When calling
containerRuntime.GetPodStatus
on a stopped pod all fields except for podStatus except forIP
andTimestamp
are returned. TheTimestamp
field seems only be used when storing in cache, see here, and here . However, we don't store this status in cache.podStatus
(*kubecontainer.PodStatus) level, not at theapiPodStatus
(v1.PodStatus) level?Both would work, but adjusting the underlying structure is less code (single field vs two), and keeps them consistent as commented here
Possibly, we could fallback the IPs inside
generateAPIPodStatus
orconvertStatusToAPIStatus
, which also have access tooldPodStatus
, containing the IPs, but this would affect many more code paths. The proposed fix is minimal to only fix the new status update introduced in Give terminal phase correctly to all pods that will not be restarted #115331: https://github.com/kubernetes/kubernetes/pull/115331/files#diff-67dd9e8f3ee257072765326cb4f242852554a2c0753563fa51e292c0a63a7b94R2022syncTerminatingPod
andsyncTerminatedPod
was the presence of theIP
fields, sosyncTerminatedPod
is skipped.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: