-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨ Add JSON log format and deprecate klog flags #6072
Conversation
4aebce0
to
fbd58a3
Compare
692aba0
to
f749411
Compare
@dims Do you think it makes sense to use component-base/logs in CAPI instead of using the klog flags directly? The main reasons for it in my opinion are to profit from upstream Kubernetes developments:
Not sure if it's problematic to depend on component-base/logs. |
+1, this seems a step in good direction towards converging with kube ecosystem common pattern. |
/test pull-cluster-api-e2e-informing-ipv6-main |
I agree. Just fyi, I moved further discussion to the issue (#5571 (comment)) and tried to summarize there what it would mean to adopt component-base/logs. |
Should we mark this as a breaking change? |
I think there are no breaking changes in this PR. From a user perspective:
I think what we should definitely do, if we decide to go ahead with this change, is document this as a recommendation (?) for providers in the v1.1=>v1.2 migration guide |
Got it, this was missed as it wasn't clear that this new line adds the same flags |
/test pull-cluster-api-e2e-informing-ipv6-main |
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'm definitely +1 to keep up with Kubernetes' new KEPs in this area.
/lgtm
Giving a little bit of time for people to review new dependency, but if no one raises concerns I'm going to get this merged sometimes next week
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
f749411
to
9895ed0
Compare
Just rebased onto current main to pull in latest changes on main. |
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
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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 |
What this PR does / why we need it:
This PR starts using components-base/logs. Through that we get the following changes:
--logging-format
(default: text, can also be set to JSON)--experimental-logging-sanitization
flag which enables the klog SanitizingFilter. This sanitizes logging of types like crypto/x509.Certificate automaticallyI think it makes sense to deprecate the klog flags in ClusterAPI too as the same reasons managed in the KEP also apply to us. I also think it makes sense to use component-base/logs as we get JSON logging for free, without having to implement it ourselves. Downside is that we depend on upstream k/component-base, but I think this should be fine.
Note: This PR does not enable JSON logging per default, which makes sense given that it's currently alpha upstream.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #5571
Related #6069
Related #3889
Some links:
* doc: klog
* doc: JSON log format
* KEP-1602: Structured Logging
* KEP-2845: Deprecate klog specific flags in Kubernetes Components