pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Consider lowering log level for AdmissionController.Admit failures

Open eddie4941 opened this issue 4 years ago • 7 comments
trafficstars

/area monitoring /kind question

Expected Behavior

Consider logging validation errors at a lower level (info) to signal that the webhook is working as expected.

Actual Behavior

The AdmissionController.Admit code logs validation error on CRD's with level==error. Validation errors are a normal function of the webhook, so logging them as level==error is perhaps to aggressive and misleading as the webhook is operating normally when validations fail this way.

Additional Info

example of logging statement: https://github.com/knative/pkg/blob/6045ed499615ecca39d92a8277489de1fbe3dcff/webhook/resourcesemantics/validation/validation_admit.go#L177

eddie4941 avatar Feb 03 '21 18:02 eddie4941

Hi @eddie4941 if not mistaken other frameworks follow this during validation of any resource. I suspect that for example in a production env these errors should be minimal, you know what you are doing, so I guess an error would be more helpful. When an Info log level is used it means in general that what is happening is normal from the user point of you as well (similar discussion here).

skonto avatar Mar 10 '21 16:03 skonto

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Jun 09 '21 01:06 github-actions[bot]

/reopen /lifecycle frozen

In @skonto's example it looks like it prints the error when it fails to marshal the response.

I think failing validation shouldn't be an error because it's expected with bad input vs. something unexpected that prevents us from responding to the request.

dprotaso avatar Jul 10 '21 03:07 dprotaso

@dprotaso: Reopened this issue.

In response to this:

/reopen /lifecycle frozen

In @skonto's example it looks like it prints the error when it fails to marshal the response.

I think failing validation shouldn't be an error because it's expected with bad input vs. something unexpected that prevents us from responding to the request.

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.

knative-prow-robot avatar Jul 10 '21 03:07 knative-prow-robot

/triage accepted /good-first-issue

julz avatar Jul 12 '21 12:07 julz

@julz: This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

/triage accepted /good-first-issue

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.

knative-prow-robot avatar Jul 12 '21 12:07 knative-prow-robot

hi, @dprotaso just lower the logging level to INFO and error should be return as before ?

hzliangbin avatar Mar 10 '22 06:03 hzliangbin

/assign

taniaduggal avatar May 01 '23 09:05 taniaduggal

/assign

Priyansurout avatar Sep 10 '23 17:09 Priyansurout

/unassign @taniaduggal

dprotaso avatar Sep 10 '23 23:09 dprotaso

/assign

xiangpingjiang avatar Nov 28 '23 15:11 xiangpingjiang