Skip to content
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

Merged
merged 1 commit into from
Mar 11, 2015

Conversation

jszczepkowski
Copy link
Contributor

Fixed writing Host in Pod.Spec during binding. Related to #5207.

@jszczepkowski
Copy link
Contributor Author

@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).

@bgrant0607
Copy link
Member

@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.
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/registry/pod/rest.go#L132

}
pod.Status.Host = machine
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jdef
Copy link
Contributor

jdef commented Mar 11, 2015

xref #5005

Fixed writing Host in Pod.Spec during binding. Related to kubernetes#5207.
@jszczepkowski jszczepkowski changed the title Fixed writing Host in Pod.Spec during binding. Implemented writing Host in Pod.Spec during binding. Mar 11, 2015
@jszczepkowski
Copy link
Contributor Author

PTAL

@bgrant0607
Copy link
Member

LGTM. Did you run e2e?

bgrant0607 added a commit that referenced this pull request Mar 11, 2015
Implemented writing Host in Pod.Spec during binding.
@bgrant0607 bgrant0607 merged commit 1a75c88 into kubernetes:master Mar 11, 2015
@yujuhong
Copy link
Contributor

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 (Spec.Host != "").

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:

  • Do not reject the binding and update Status.Host
  • Update pod_cache.go to check Spec.Host too.

@bgrant0607, which do you prefer?

@bgrant0607
Copy link
Member

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?

@yujuhong
Copy link
Contributor

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.

@bgrant0607
Copy link
Member

How hard is it really to set Status.Host from Spec.Host?

@bgrant0607
Copy link
Member

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).

jszczepkowski added a commit to jszczepkowski/kubernetes that referenced this pull request Mar 12, 2015
Fixed pods e2e test. The test was failing due to PR kubernetes#5256.
@lavalamp
Copy link
Member

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.

@lavalamp
Copy link
Member

BTW the error message is super confusing now; it should %q the strings because the second one is blank for me.

akram pushed a commit to akram/kubernetes that referenced this pull request Apr 7, 2015
Fixed pods e2e test. The test was failing due to PR kubernetes#5256.
@jszczepkowski jszczepkowski deleted the podspec-host branch August 10, 2015 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants