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

Updating generic registry to return UID of the deleted resource #45600

Merged
merged 3 commits into from
May 15, 2017

Conversation

nikhiljindal
Copy link
Contributor

@nikhiljindal nikhiljindal commented May 10, 2017

Ref #42594

cc @kubernetes/sig-api-machinery-pr-reviews @smarterclayton

Updating apiserver to return UID of the deleted resource. Clients can use this UID to verify that the resource was deleted or waiting for finalizers.

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 10, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels May 10, 2017
@@ -1083,7 +1083,9 @@ func finishRequest(timeout time.Duration, fn resultFunc) (result runtime.Object,
select {
case result = <-ch:
if status, ok := result.(*metav1.Status); ok {
return nil, errors.FromObject(status)
if status.Status != metav1.StatusSuccess {
Copy link
Contributor Author

@nikhiljindal nikhiljindal May 10, 2017

Choose a reason for hiding this comment

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

This is an API change. We will now return a metav1.Status object where we were returning a StatusError object earlier. We should have always been returning a StatusError only in case of errors.
This was the only place where errors.FromObject was being used even when status is StatusSuccess: https://github.com/kubernetes/kubernetes/search?q=errors.FromObject.

So the fix should be fine but wanted to highlight it as an important change.

Copy link
Contributor

Choose a reason for hiding this comment

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

I need to think about the implications of this.

@soltysh
Copy link
Contributor

soltysh commented May 11, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 11, 2017
@nikhiljindal
Copy link
Contributor Author

cc @kubernetes/api-reviewers since it is an api change

@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 11, 2017
@nikhiljindal
Copy link
Contributor Author

Rebased and added another commit with auto-generated swagger docs.

@soltysh
Copy link
Contributor

soltysh commented May 12, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 12, 2017
if err != nil {
return nil, err
}
details := &metav1.StatusDetails{UID: accessor.GetUID()}
Copy link
Contributor

Choose a reason for hiding this comment

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

You should set name here as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

And the other attributes.

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

@smarterclayton smarterclayton removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 12, 2017
@smarterclayton
Copy link
Contributor

Removing label, have additional comments.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 13, 2017
@nikhiljindal
Copy link
Contributor Author

Fixed the code to set name and other attributes as well

if err != nil {
return nil, err
}
gvk := obj.GetObjectKind().GroupVersionKind()
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't going tone correct - you need to use the GVR passed to the store (Kind on StatusDetails really means Resource, this was a problem we created for ourselves)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I see now that we set Kind to resource at another place:

.
That is definitely wrong. We should add another Resource field and deprecate kind. Should at least add a comment in API docs saying value of Kind field is resource.

Updated the code to set Kind to store.QualifiedResource.Resource.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2017
@nikhiljindal
Copy link
Contributor Author

Rebased and updated code as per comments.
PTAL.

@smarterclayton smarterclayton added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label May 15, 2017
@smarterclayton
Copy link
Contributor

/lgtm

thanks

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 15, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nikhiljindal, smarterclayton, soltysh

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 15, 2017
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 15, 2017
@nikhiljindal
Copy link
Contributor Author

Rebased and ran hack/update-federation-api-reference-docs.sh again to fix failing Jenkins verification

@nikhiljindal
Copy link
Contributor Author

@k8s-bot node e2e test this
@k8s-bot pull-kubernetes-federation-e2e-gce test this

@nikhiljindal nikhiljindal added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 15, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 41331, 45591, 45600, 45176, 45658)

@k8s-github-robot k8s-github-robot merged commit a4307eb into kubernetes:master May 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants