-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Minimal status mutation change #4779
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
|
||
ReturnDeletedObject: true, | ||
AfterDelete: bindings.AfterDelete, | ||
statusStore.UpdateStrategy = pod.StatusStrategy |
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.
Does it work? StatusStrategy does not implement some methods from RESTUpdateStrategy:
- NamespaceScoped() bool
- AllowCreateOnUpdate() bool
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.
Forget that! I've missed that you have anonymous field Strategy.
I have a general question. Before this PR pod status was periodically fetched by pod_cache and stored in memory. It was written to etcd only when someone updated pod via REST API. This PR combined with #4561 (thanks for doing part of the work! :) ) will result in writing status for every update. Is this expected? I imagine this can have a significant effect on performance. |
This doesn't necessarily make that change, but status updates can definitely ramp up the write load. We need to test the change for sure and get a feel for the cost.
|
xref #4103 |
LGTM |
@bprashanth: You'll want to use this pattern for replicationcontroller status. |
I'll be cleaning this up soon, then we'll do the pod-status writer in a second pull.
|
4b90d1c
to
dd8672a
Compare
I'll do the cleanup and other work in a follow up (since this can standalone) |
Ready for final review |
_output/local/go/src/github.com/GoogleCloudPlatform/kubernetes/pkg/registry/etcd/etcd_test.go:44: assignment count mismatch: 2 = 3 |
|
||
allErrs = append(allErrs, ValidateObjectMetaUpdate(&oldPod.ObjectMeta, &newPod.ObjectMeta).Prefix("metadata")...) | ||
|
||
// TODO: allow change when bindings are properly decoupled from pods |
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.
In what situation would we allow changes? Pods don't get rescheduled, and I'm thinking that the cleanest way to deal with rejection from Kubelet is to consider the pod dead.
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.
If we ever wanted to allow scheduler to mutate status instead of binding, but no other reason. I'll remove the todo
On Feb 26, 2015, at 11:09 PM, Brian Grant notifications@github.com wrote:
In pkg/api/validation/validation.go:
@@ -647,6 +647,23 @@ func ValidatePodUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList {
return allErrs
}+// ValidatePodStatusUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields
+// that cannot be changed.
+func ValidatePodStatusUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList {
- allErrs := errs.ValidationErrorList{}
- allErrs = append(allErrs, ValidateObjectMetaUpdate(&oldPod.ObjectMeta, &newPod.ObjectMeta).Prefix("metadata")...)
- // TODO: allow change when bindings are properly decoupled from pods
In what situation would we allow changes? Pods don't get rescheduled, and I'm thinking that the cleanest way to deal with rejection from Kubelet is to consider the pod dead.—
Reply to this email directly or view it on GitHub.
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'm also thinking we should get rid of host in Status, and just set the one in Spec -- the scheduler is a finalizer.
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.
So would end users be able to set it?
On Feb 26, 2015, at 11:12 PM, Brian Grant notifications@github.com wrote:
In pkg/api/validation/validation.go:
@@ -647,6 +647,23 @@ func ValidatePodUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList {
return allErrs
}+// ValidatePodStatusUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields
+// that cannot be changed.
+func ValidatePodStatusUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList {
- allErrs := errs.ValidationErrorList{}
- allErrs = append(allErrs, ValidateObjectMetaUpdate(&oldPod.ObjectMeta, &newPod.ObjectMeta).Prefix("metadata")...)
- // TODO: allow change when bindings are properly decoupled from pods
I'm also thinking we should get rid of host in Status, and just set the one in Spec -- the scheduler is a finalizer.—
Reply to this email directly or view it on GitHub.
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.
Never mind, binding sets it. I keep forgetting....
On Feb 26, 2015, at 11:12 PM, Brian Grant notifications@github.com wrote:
In pkg/api/validation/validation.go:
@@ -647,6 +647,23 @@ func ValidatePodUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList {
return allErrs
}+// ValidatePodStatusUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields
+// that cannot be changed.
+func ValidatePodStatusUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList {
- allErrs := errs.ValidationErrorList{}
- allErrs = append(allErrs, ValidateObjectMetaUpdate(&oldPod.ObjectMeta, &newPod.ObjectMeta).Prefix("metadata")...)
- // TODO: allow change when bindings are properly decoupled from pods
I'm also thinking we should get rid of host in Status, and just set the one in Spec -- the scheduler is a finalizer.—
Reply to this email directly or view it on GitHub.
LGTM, other than the test failure and TODO. |
PUT /api/v1beta3/namespaces/default/pods/foo/status { "metadata": {...}, // allowed for valid values "spec": {}, // ignored "status": {...}, // allowed, except for Host } Exposes the simplest possibly change. Needs a slight refactoring to RESTUpdateStrategy to split merging which can be done in a follow up.
dd8672a
to
3d29008
Compare
Fixed comments and failing test. |
Minimal status mutation change
I synced to HEAD, but my cluster does not recognize this new handler. Is this only available in v1beta3? |
It works after kube-down/kube-up. I thought that dev-build-and-push should be enough, but apparently not. |
Exposes the simplest possibly change. Needs a slight refactoring
to RESTUpdateStrategy to split merging.
Sets the stage for #2726