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
cloud-provider: add log options, allow setting logging-format via CLI option #108984
cloud-provider: add log options, allow setting logging-format via CLI option #108984
Conversation
Welcome @LittleFox94! |
Hi @LittleFox94. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
/ok-to-test
afc0bc3
to
e916ff9
Compare
whoops - sorry for the failed CI run and noise |
hm.. that failed test looks weird, like not a problem of me? Strange log entry
/retest |
@andrewsykim can you please take a look at the failing test, if there is something I have to do? |
/retest |
Please take another look @andrewsykim, @deads2k or @wlan0 Tests ran successfully, now only needs another look at the code and hopefully merge :) Thanks :) |
e916ff9
to
c37723a
Compare
afe88c0
to
82edb64
Compare
This PR is slowly approaching an age of one year, with a multitude of rebases in between and, as I learnt now, rebases will reset the lgtm label.. Would be really great to get this merged, seems like most required review is done already anyway? What's blocking this? |
Someone who has approval powers for the code has to approve it. It's unfortunate that people ignore assigned PRs, but it happens. In that case, bring it to the SIG which owns the code and ask for approval. |
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
LGTM label has been added. Git tree hash: 90d9738091b998974527ccccb19176fd9db378d3
|
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
Thanks and sorry for the delay
@@ -85,6 +89,11 @@ the cloud specific control loops shipped with Kubernetes.`, | |||
verflag.PrintAndExitIfRequested() | |||
cliflag.PrintFlags(cmd.Flags()) | |||
|
|||
if err := logsapi.ValidateAndApply(logOptions, nil); err != nil { |
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.
What's the reason for nil feature gate 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.
docs say "If nil, the default for these features is used", which sounds like a good fit 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.
e.g. metrics-server does the same: https://github.com/kubernetes-sigs/metrics-server/blob/master/cmd/metrics-server/app/options/options.go#L59
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.
metrics-server doesn't inherit and default feature gates from Kubernetes though -- I think at the very least we want to use the default feature gate we register here: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/cloud-provider/app/controllermanager.go#L66
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.
utilfeature.DefaultFeatureGate
is actually better because it doesn't have to be mutable.
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.
@pohly added it to the DefaultMutableFeatureGate, same as component-base/metrics/features
is added already
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.
Before I just rebase this PR again, is the way I implemented the feature gate ok?
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.
Yes, looks good to me.
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.
thanks :)
so another version prepared, freshly rebased and ready for your eyes @andrewsykim :)
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.
another ping @andrewsykim
|
||
globalFlagSet := namedFlagSets.FlagSet("global") | ||
verflag.AddFlags(globalFlagSet) | ||
logsapi.AddFlags(logOptions, globalFlagSet) |
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 general, I would like the logging options here to be consistent with kube-controller-manager and this seems to deviate from this: https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-controller-manager/app/controllermanager.go#L155-L162
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.
Ah, actually we are still doing this here: https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-controller-manager/app/options/options.go#L188
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.
so this can stay as-is or should I change something?
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 it can stay as-is
/hold (holding for the question on feature gates) |
862096c
to
a420cb8
Compare
a420cb8
to
51bcaac
Compare
Change k8s.io/cloud-provider/app.NewCloudControllerManagerCommand to create a k8s.io/component-base/logs.Options, add it to the flags for the command and apply them on startup. This adds the logging-format command line option.
Extend the cloud-provider sample to register the JSON log format.
51bcaac
to
7601347
Compare
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
/hold cancel
LGTM label has been added. Git tree hash: f31d383e5beeedf2a651ff8c4a2be417bbccc325
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewsykim, LittleFox94, pohly 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 type of PR is this?
/kind feature
What this PR does / why we need it:
This PR allows users to configure logging format for CCMs based on k8s.io/cloud-provider.
Does this PR introduce a user-facing change?