-
Notifications
You must be signed in to change notification settings - Fork 1.2k
🐛 Avoid marshalling error in debug log line #989
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
Conversation
Hi @databus23. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
/assign @alvaroaleman |
pkg/webhook/admission/http.go
Outdated
@@ -99,6 +99,6 @@ func (wh *Webhook) writeResponse(w io.Writer, response Response) { | |||
wh.writeResponse(w, Errored(http.StatusInternalServerError, err)) | |||
} else { | |||
res := responseAdmissionReview.Response | |||
wh.log.V(1).Info("wrote response", "UID", res.UID, "allowed", res.Allowed, "result", res.Result) | |||
wh.log.V(1).Info("wrote response", "UID", res.UID, "allowed", res.Allowed, "code", res.Result.Code, "reason", res.Result.Reason) |
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.
res.Result
might be nil if the request gets approved, if we just unconditionally access it like this we might panic
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.
/hold
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.
Ups. Good catch!
0bd08ae
to
21139a3
Compare
Currently every webhook requests ended up logging this in debug: ``` 2020-06-10T16:04:20.883+0200 DEBUG controller-runtime.webhook.webhooks wrote response {"webhook": "/validate-some-resource", "UID": "e5d00608-7f47-4d00-bd91-b1a8955dc5a7", "allowed": true, "result": {}, "resultError": "got runtime.Object without object metadata: &Status{ListMeta:ListMeta{SelfLink:,ResourceVersion:,Continue:,RemainingItemCount:nil,},Status:,Message:,Reason:,Details:nil,Code:200,}"} ``` The problem is that a `Status` Object is a runtime.Object but which has no metadata which is not well received the `KubeAwareEncoder`. Signed-off-by: Fabian Ruff <[email protected]>
/retest |
@vincepri I addressed the nil pointer access. Not sure about the failing tests now. I think its unrelated timeouts happening somewhere else. |
/test pull-controller-runtime-test-master |
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.
/lgtm
Thanks!
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: databus23, vincepri 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 |
/hold cancel |
/retest |
@databus23, did this fix make it into 0.6.2? |
@databus23 - actually - never mind :) |
Needs a new release, probably going to do one tomorrow if time permits |
Currently every webhook requests ended up logging this in debug:
The problem is that a
Status
Object is a runtime.Object with no metadata which is not well received by thezap.KubeAwareEncoder
.