Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 support for JSON logging #1467
Add support for JSON logging #1467
Changes from all commits
ad25982
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Not now, but we should consider making JSON the default sometime in the future.
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.
Looking at the proposal, they seem to have text as default. Do we want to have this changed prematurely, considering that this will render the divergence between the default formats for core k8s and CSI driver's logs, which may not be a good customer experience?
My feeling is that we should keep the parity with k8s on that. When they change the default setting, it will make sense for us to do the same.
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.
In my opinion, we should keep the same default as k8s unless we have a strong reason not to do so.
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.
If we go with the default logging format, e.g.
text
, do we still need to register json log format?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.
Similar to other K8s components such as Kubelet we register supported log formats as early possible and before the flag is set, as this information needs to be known in advance:
https://github.com/kubernetes/component-base/blob/33f62c7b28186a591e1b25e900fe573ed296e181/logs/api/v1/options.go#L186 (names of registered log formats retrieved) -> https://github.com/kubernetes/component-base/blob/33f62c7b28186a591e1b25e900fe573ed296e181/logs/api/v1/options.go#L187 (
logging-format
flag is added, listing permitted formats).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.
Do the previous versions not work anymore? Do we care about this theoretically breaking change?
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.
To provide some context, this change was introduced as a result of migrating to the
pflag
package which is a "drop-in replacement for Go's flag package". This flag type is used to add the component-based flags: https://pkg.go.dev/k8s.io/component-base/logs/api/v1#AddFlags.Unlike Go's standard flag package, when using the
pflag
package, a single dash before an option means something different than a double dash. Single dashes signify a series of shorthand letters for flags. Hence this change.The new behavior for using the "shorthand flags"
-
is as follows:It is common convention to use a single hyphen
-
to specify a single character flag, and a double hyphen--
to specify a keyword flag so I don't believe this change is particularly dangerous but if it is a concern we could theoretically support shorthand flags as well.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 think this is an acceptable justification, but we MUST make sure to call this out in the changelog.