-
Notifications
You must be signed in to change notification settings - Fork 39.6k
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 '--logging-format' flag to kube-controller-manager #91521
Conversation
Signed-off-by: SataQiu <1527062125@qq.com>
/cc @serathius |
/retest |
/lgtm |
I have some of the same concerns as #91501 (comment). Also a bit confused about the usage. It seems to be set up for dynamic configuration (use of locks etc on Set and Register and the fact that they are public) but the validate does not use locks and will only be checked at start up. This seems prone to race conditions (except for things setup in the init setup). |
Hey @cheftako As for usage, flag was not implemented to be thread safe, internal register is, as we use it in a global variable. It was not implemented to support dynamic configuration, not I think we should support it. I'm not familiar with it, so I could be wrong. I don't think there is a sense to make this flag thread safe. WDYT? |
/retest |
I agree. I understand that your usage is not intended to be thread safe. However the logs library seems confused on this. It has a Register() method, whish is public, uses lock to ensure safe addition on new loggers and the documentation that does not mention any restrictions on adding logger methods. To me this implies new loggers can be added at any time. However the init() and Validate() methods in it suggest, as you say, that it does not support dynamic configuration. Lets take a look once we have Json format. |
PR updating flag to inform about JSON foramt was merged. Can go move forward with this one? @cheftako |
/lgtm |
/approve |
/priority important-soon |
/sig api-machinery |
/hold |
/unhold |
/sig instrumentation |
/milestone v1.19 |
@@ -249,6 +252,7 @@ func (s *KubeControllerManagerOptions) Flags(allControllers []string, disabledBy | |||
s.SAController.AddFlags(fss.FlagSet("serviceaccount controller")) | |||
s.TTLAfterFinishedController.AddFlags(fss.FlagSet("ttl-after-finished controller")) | |||
s.Metrics.AddFlags(fss.FlagSet("metrics")) | |||
s.Logs.AddFlags(fss.FlagSet("logs")) |
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.
Does this fit better into generic? Is it just one flag? Where are the other klog flags?
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.
Other klog flags are Global flags. I think this flag should be in same flagSet logs
as in other control plane components.
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.
https://gist.github.com/fd93b5d6044d7c256d2e70fcabf503ae does it. All logging flags will be under the logs section.
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.
My gist does not move log-flush-frequency
yet. That's also defined in component-base/logs and has to go to the named flag set.
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.
As the proposed change is bigger (removes the init func behaviour of the package), I am fine to postpone this to 1.20. But would like to see a PR started with the gist, tagged with the relevant people before approving this PR here.
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.
Done #92707
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.
We agreed to keep this new logs section for now, and move klog flags over in a follow-up (in 1.19 or 1.20 if we miss code freeze).
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cheftako, SataQiu, sttts 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 |
/test pull-kubernetes-e2e-gce-100-performance |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add
--logging-format
flag to kube-controller-manager.Which issue(s) this PR fixes:
Ref kubernetes/enhancements#1602
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: