Skip to content
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

⚠ Change webhook request received / response written logs to log level 4 #2334

Merged
merged 1 commit into from
May 19, 2023

Conversation

sbueringer
Copy link
Member

Tested a bit with the CR beta and the logs are very verbose.

I"m not sure if that was also the case with v0.14 but 4 seems more reasonable.

xref: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 19, 2023
@sbueringer
Copy link
Member Author

/assign @alvaroaleman @fabriziopandini

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 19, 2023
@@ -136,11 +136,11 @@ func (wh *Webhook) writeAdmissionResponse(w io.Writer, ar v1.AdmissionReview) {
}
} else {
res := ar.Response
if log := wh.getLogger(nil); log.V(1).Enabled() {
if log := wh.getLogger(nil); log.V(4).Enabled() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is technically a breaking change in that the logs may disappear when running on v1, right?

Copy link
Member Author

@sbueringer sbueringer May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Not sure if we consider logs as part of our API. As far as I'm aware k/k doesn't.

If it's just about changing the PR title, no objections against changing to breaking

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the PR title

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have full context and I defer the decision to the team, but as far as I remember in previous versions of controller runtime those logs lines were not generated, so it could also be considered a fix...

Copy link
Member

@alvaroaleman alvaroaleman May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, is this new relative to 0.14?

Copy link
Member Author

@sbueringer sbueringer May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked. The behavior was the same with 0.14. We just didn't notice it before as we are running our controllers per default with log level 0. (we just use a higher log level for dev)

The recommended production log level is 2 though IIRC. I couldn't find a quote for that though.

But based on the guidance I think 1 is not appropriate (https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md).

@sbueringer sbueringer changed the title 🌱 Reduce webhook log verbosity ⚠ Reduce webhook log verbosity May 19, 2023
@fabriziopandini
Copy link
Member

Thanks for this PR, those logs are really noisy and they are making it harder to read controller logs.

@sbueringer sbueringer changed the title ⚠ Reduce webhook log verbosity ⚠ Change webhook request received / response written logs to log level 4 May 19, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, sbueringer

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:
  • OWNERS [alvaroaleman,sbueringer]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit e7b9407 into kubernetes-sigs:main May 19, 2023
@sbueringer sbueringer deleted the pr-webhook-log-levels branch May 19, 2023 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants