-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Use pod UID as cache key instead of namespace/name #61069
Use pod UID as cache key instead of namespace/name #61069
Conversation
b4160de
to
f07fefa
Compare
/retest |
@@ -495,7 +494,7 @@ func (n *NodeInfo) FilterOutPods(pods []*v1.Pod) []*v1.Pod { | |||
|
|||
// getPodKey returns the string key of a pod. | |||
func getPodKey(pod *v1.Pod) (string, error) { | |||
return clientcache.MetaNamespaceKeyFunc(pod) | |||
return string(pod.UID), 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.
Could you please add a check to return an error when pod.UID is empty?
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.
sure. I thought it is always non-empty? can I ask when it's empty?
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.
It shouldn't be empty, but a bug in the system could leave it empty. It could also be left empty in our tests. So, it would be good to check and return an error.
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.
make sense. just curious.
We should include this in 1.10 as this is a bug fix. |
/kind bug Throwing the labels for @bsalamat |
/status approved-for-milestone |
@bsalamat @jayunit100 All it needs now is a lgtm from one of you |
Shouldn't we update the filter code as well which checks if the pod exists in the pod list? https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/schedulercache/node_info.go#L509 |
@sig-scheduling-maintainers PTAL ASAP |
It would be better to change the filter function as well. It is not necessary for this PR to work correctly though. |
f07fefa
to
06f52ab
Compare
UID uniquely identifies pods across lifecycles, while namespace/name could be 2 different pods across lifecycles. This could result in tricky scheduler bugs. Fixes kubernetes#60966
06f52ab
to
5bad68a
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: anfernee, bsalamat 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 |
[MILESTONENOTIFIER] Milestone Pull Request: Up-to-date for process Pull Request Labels
|
/retest |
Automatic merge from submit-queue (batch tested with PRs 61111, 61069). If you want to cherry-pick this change to another branch, please follow the instructions here. |
This bug actually exists in previous releases, we need to cherry pick it in 1.9 at least. |
@resouer I agree. Could you please create a cherry pick PR for 1.9? |
@bsalamat Sure, will do! |
UID uniquely identifies pods across lifecycles, while namespace/name
could be 2 different pods across lifecycles. This could result in
tricky scheduler bugs.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #60966
Special notes for your reviewer: @bsalamat
Release note: