-
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
Implemented writing Host in Pod.Spec during binding. #5256
Conversation
@bgrant0607 This is the implementation of the first step from #5207. It seems that there was a bug in #2097 in setPodHostTo method: pod.DesiredState was chanaged to Status instead of Spec (pkg/registry/etcd/etcd.go:190). |
@jszczepkowski It wasn't a bug, it was a hack. The problem is that users can set Spec.Host, but the scheduler needs to post the binding in order for the pod to be added to BoundPods. The scheduler effectively watches status.host, so we need to continue to write that for now. |
} | ||
pod.Status.Host = machine |
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.
Just write both Status.Host and Spec.Host for now.
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.
Done.
xref #5005 |
Fixed writing Host in Pod.Spec during binding. Related to kubernetes#5207.
f9dc473
to
9a6857c
Compare
PTAL |
LGTM. Did you run e2e? |
Implemented writing Host in Pod.Spec during binding.
This PR seems incorrect to me... If you set the Host field in the PodSpec, the Host field in the pod status would never be updated because the binding was rejected prematurely ( As a result, pod (status) cache will never check kubelet for the actual status (it relies on the Status.Host). The pod is hence stuck at pending forever. You can reproduce this issue by creating a pod with Spec.Host set to an non-empty string. There are two ways to solve this issue:
@bgrant0607, which do you prefer? |
rm pod_cache.go? Won't this be fixed by #5205? Ok, good catch. I'd prefer to eliminate Status.Host from the internal representation, populate it from Spec.Host in the conversion code, remove it from v1beta3, and eliminate all other accesses to Status.Host in our own code? |
Yes, #5205 might fix this, under the condition than kubelet is watching Spec.Host, not Status.Host. (I'm not sure which one it watches currently, or in the proposed PR). Ideally we should do what you suggested. Given this is a bug introduced by this PR and it affects the use of Spec.Host, I'd like to either do a quick fix using one of the methods I suggested or just revert the PR. |
How hard is it really to set Status.Host from Spec.Host? |
If it is non-trivial, then I have no preference between your alternatives -- whatever is easiest. Regardless, it should be ripped out in O(days). |
Fixed pods e2e test. The test was failing due to PR kubernetes#5256.
Somehow in my local e2e test, I'm getting pods with one of these fields set but not the other. Trying to figure out if it's a local change I made or if this broke things. |
BTW the error message is super confusing now; it should %q the strings because the second one is blank for me. |
Fixed pods e2e test. The test was failing due to PR kubernetes#5256.
Fixed writing Host in Pod.Spec during binding. Related to #5207.