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

Add '--logging-format' flag to kube-controller-manager #91521

Merged
merged 1 commit into from
Jul 2, 2020

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented May 28, 2020

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?:

kube-controller-manager: add '--logging-format' flag to support structured logging

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

NONE

Signed-off-by: SataQiu <1527062125@qq.com>
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 28, 2020
@SataQiu
Copy link
Member Author

SataQiu commented May 28, 2020

/cc @serathius

@serathius
Copy link
Contributor

/retest

@serathius
Copy link
Contributor

/lgtm
/assign @sttts

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2020
@cheftako
Copy link
Member

/assign @cheftako
/cc @cici37

@cheftako
Copy link
Member

cheftako commented May 29, 2020

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).

@serathius
Copy link
Contributor

Hey @cheftako
We are working on implementing json format, hope to get it merged soon.

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?

@serathius
Copy link
Contributor

serathius commented Jun 16, 2020

Json format was added. #91490
PR to update help listing available options is in flight. #92177

I think we can proceed with this PR. @sttts PTAL

@SataQiu
Copy link
Member Author

SataQiu commented Jun 16, 2020

/retest

@cheftako
Copy link
Member

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?

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.

@serathius
Copy link
Contributor

PR updating flag to inform about JSON foramt was merged. Can go move forward with this one? @cheftako

@cheftako
Copy link
Member

/lgtm

@cheftako
Copy link
Member

/approve

@cheftako
Copy link
Member

/priority important-soon

@k8s-ci-robot k8s-ci-robot added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jun 22, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jun 22, 2020
@cheftako
Copy link
Member

/sig api-machinery

@serathius
Copy link
Contributor

/hold
Reason same as #91522 (comment)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 22, 2020
@serathius
Copy link
Contributor

/unhold
Flag validation was implemented, #92394 (comment)
/assign @sttts

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 1, 2020
@serathius
Copy link
Contributor

/sig instrumentation

@k8s-ci-robot k8s-ci-robot added sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 1, 2020
@serathius
Copy link
Contributor

/milestone v1.19

@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Jul 1, 2020
@@ -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"))
Copy link
Contributor

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?

Copy link
Contributor

@serathius serathius Jul 1, 2020

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done #92707

Copy link
Contributor

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).

@sttts
Copy link
Contributor

sttts commented Jul 1, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 1, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Jul 2, 2020

/test pull-kubernetes-e2e-gce-100-performance

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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants