Skip to content

Commit 1abbd13

Browse files
authored
Merge pull request #989 from databus23/patch-2
🐛 Avoid marshalling error in debug log line
2 parents 4ebccea + 79de63c commit 1abbd13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/webhook/admission/http.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ func (wh *Webhook) writeResponse(w io.Writer, response Response) {
9999
wh.writeResponse(w, Errored(http.StatusInternalServerError, err))
100100
} else {
101101
res := responseAdmissionReview.Response
102-
wh.log.V(1).Info("wrote response", "UID", res.UID, "allowed", res.Allowed, "result", res.Result)
102+
if log := wh.log; log.V(1).Enabled() {
103+
if res.Result != nil {
104+
log = log.WithValues("code", res.Result.Code, "reason", res.Result.Reason)
105+
}
106+
log.V(1).Info("wrote response", "UID", res.UID, "allowed", res.Allowed)
107+
}
103108
}
104109
}

0 commit comments

Comments
 (0)