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
Fix issue that Audit Server could not correctly encode metav1.DeleteOption #110110
Fix issue that Audit Server could not correctly encode metav1.DeleteOption #110110
Conversation
/triage accepted |
@@ -103,7 +103,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope *RequestSc | |||
trace.Step("Decoded delete options") | |||
|
|||
objGV := gvk.GroupVersion() | |||
audit.LogRequestObject(req.Context(), obj, objGV, scope.Resource, scope.Subresource, scope.Serializer) | |||
audit.LogRequestObject(req.Context(), obj, objGV, scope.Resource, scope.Subresource, metainternalversionscheme.Codecs) |
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.
Can you please add some unit test for these?
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.
Thanks for your suggestion, I have added Unit test to this modification. PTAL, thx~
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.
/ping @wojtek-t
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.
The test you added doesn't verify the fix you're making in this PR.
I would like to see some test that fails before this change and is passing with this change...
943ec09
to
16a9dbc
Compare
/retest-required |
16a9dbc
to
18aed16
Compare
serializer: metainternalversionscheme.Codecs, | ||
}, | ||
{ | ||
name: "encode v1 DeleteOptions", |
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 don't understand the difference between those two cases (TypeMeta shouldn't really matter here...)
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 have a wrong understanding of Codec here, and the redundant tests have been deleted.
@@ -103,7 +103,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope *RequestSc | |||
trace.Step("Decoded delete options") | |||
|
|||
objGV := gvk.GroupVersion() | |||
audit.LogRequestObject(req.Context(), obj, objGV, scope.Resource, scope.Subresource, scope.Serializer) | |||
audit.LogRequestObject(req.Context(), obj, objGV, scope.Resource, scope.Subresource, metainternalversionscheme.Codecs) |
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.
The test you added doesn't verify the fix you're making in this PR.
I would like to see some test that fails before this change and is passing with this change...
12287ad
to
4b1445f
Compare
I've added test cases for encoding v1.DeleteOptions without using
Please take a look. thank you for your time. /ping @wojtek-t |
4b1445f
to
a40110a
Compare
/retest-required |
/ping @wojtek-t PTAL thx~ |
Please correct me if I understand wrong.
|
But the same test is passing without the big being done in this PR. I would like to test the fix that you're doing [so whether the right parameters are passed]. |
a40110a
to
a47c94d
Compare
I see what you mean. In response to your suggestion, I have revised the unit test again, please take a look at it, thank you for your time. @wojtek-t |
a47c94d
to
286a67d
Compare
/ping @wojtek-t PTAL thx. |
What do you need my help to do to move this thing forward? @wojtek-t |
OK - this looks fine - thanks! /release-note none |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sxllwx, wojtek-t 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 |
thx~ |
…10-upstream-release-1.24 Automated cherry pick of #110110: Fix issue that Audit Server could not correctly encode
…10-upstream-release-1.23 Automated cherry pick of #110110: Fix issue that Audit Server could not correctly encode
What type of PR is this?
What this PR does / why we need it:
When using kube-apiserver audit webhook, the following logs were found:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
The first log is triggered by Delete Namespace, and the rest can be triggered by installing any CRD and Delete Namespace.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: