-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Conversation
@@ -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 { |
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.
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.
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 need to think about the implications of this.
/lgtm |
cc @kubernetes/api-reviewers since it is an api change |
Rebased and added another commit with auto-generated swagger docs. |
/lgtm |
if err != nil { | ||
return nil, err | ||
} | ||
details := &metav1.StatusDetails{UID: accessor.GetUID()} |
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.
You should set name here as well.
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.
And the other attributes.
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
Removing label, have additional comments. |
Fixed the code to set name and other attributes as well |
if err != nil { | ||
return nil, err | ||
} | ||
gvk := obj.GetObjectKind().GroupVersionKind() |
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.
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)
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.
ok I see now that we set Kind to resource at another place:
Kind: qualifiedResource.Resource, |
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.
Rebased and updated code as per comments. |
/lgtm thanks |
[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 |
Rebased and ran |
Automatic merge from submit-queue (batch tested with PRs 41331, 45591, 45600, 45176, 45658) |
Ref #42594
cc @kubernetes/sig-api-machinery-pr-reviews @smarterclayton