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

Pass ResourceVersion in Scale object back to RC before updating RC so that it can be used to check for conflicts. #22769

Merged
merged 1 commit into from Mar 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/registry/experimental/controller/etcd/etcd.go
Expand Up @@ -88,6 +88,7 @@ func (r *ScaleREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object,
return nil, false, errors.NewNotFound(extensions.Resource("replicationcontrollers/scale"), scale.Name)
}
rc.Spec.Replicas = scale.Spec.Replicas
rc.ResourceVersion = scale.ResourceVersion
Copy link
Member

Choose a reason for hiding this comment

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

@bgrant0607 are we going to require every client submitting a scale request do a Get first and handle retry on conflict, or allow an empty resource version if the client doesn't care about current state and just wants to submit a scale request? I'd expect to only set this if len(scale.ResourceVersion) > 0. Same goes for the Update methods on Deployments and ReplicaSet, I think

Copy link
Member

Choose a reason for hiding this comment

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

@liggitt If scale.ResourceVersion is empty string, this should result in an unconditional update, whereas if we didn't copy the empty string, the user could get spurious update failures.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I'd forgotten that. That means if the client's intent was to only update the scale bit unconditionally, that means the server-side impl could stomp a change in another part of the rc/rs/deployment.

If the incoming scale has no ResourceVersion, I would expect the server to do the get/update inside a retryonconflict loop, fulfilling client intent while being a good citizen and not stomping bits unrelated to scale. I guess we don't do that today, so it's not a regression, and the window is small, but it would be an improvement (whether or not it happens for 1.2)

rc, err = (*r.registry).UpdateController(ctx, rc)
if err != nil {
return nil, false, errors.NewConflict(extensions.Resource("replicationcontrollers/scale"), scale.Name, err)
Expand Down