-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
⚠️ introduce PatchResponseFromRaw and drop PatchResponse #256
Conversation
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 prefer this version over the other. Would like @DirectXMan12 thoughts on it.
pkg/webhook/admission/response.go
Outdated
} | ||
} | ||
|
||
// PatchResponse is DEPRECATED. Use PatchResponseFromRaw instead. |
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.
It will be good to highlight why is this being deprecated (may be refer to the issue which explains the roundtripping) ?
@@ -54,7 +56,23 @@ func ValidationResponse(allowed bool, reason string) types.Response { | |||
return resp | |||
} | |||
|
|||
// PatchResponse returns a new response with json patch. | |||
// PatchResponseFromRaw takes 2 byte arrays and returns a new response with json patch. | |||
func PatchResponseFromRaw(original, current []byte) types.Response { |
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 prefer this over the other PR which takes three params original, current, originalRawBytes
which could get confusing for the end user and also not help user avoid the round-tripping issue.
agree with @droot's comments. |
@droot @DirectXMan12 PTAL |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: droot, mengqiy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This should be ready to go. |
fixes kubernetes-sigs/kubebuilder#510
This PR supersedes #251.
This PR introduces PatchResponseFromRaw and drops PatchResponse.
This is a breaking change, so should released in v0.2.0.