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

cloud-provider: add log options, allow setting logging-format via CLI option #108984

Merged

Conversation

LittleFox94
Copy link
Contributor

@LittleFox94 LittleFox94 commented Mar 24, 2022

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?

* add logging-format option to CCMs based on k8s.io/cloud-provider

@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/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 24, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @LittleFox94!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 24, 2022
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/cloudprovider sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. labels Mar 24, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Mar 24, 2022
Copy link
Member

@andrewsykim andrewsykim left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 24, 2022
@LittleFox94 LittleFox94 force-pushed the cloud-provider/logging-format branch from afc0bc3 to e916ff9 Compare March 24, 2022 21:07
@k8s-ci-robot k8s-ci-robot added the area/dependency Issues or PRs related to dependency changes label Mar 24, 2022
@LittleFox94
Copy link
Contributor Author

whoops - sorry for the failed CI run and noise

@LittleFox94
Copy link
Contributor Author

hm.. that failed test looks weird, like not a problem of me?

Strange log entry
Terminated (Error - Program process in pidfile '/var/run/docker-ssd.pid', 1 process(es), refused to die. ================================================================================ Done cleaning up after docker in docker. {"component":"entrypoint","error":"wrapped process failed: exit status 2","file":"k8s.io/test-infra/prow/entrypoint/run.go:80","func":"k8s.io/test-infra/prow/entrypoint.Options.Run","level":"error","msg":"Error executing test process","severity":"error","time":"2022-03-24T21:54:43Z"} ) at 2022-03-24 21:54:43 +0000 UTC with exit code 2
--


/retest

@LittleFox94
Copy link
Contributor Author

@andrewsykim can you please take a look at the failing test, if there is something I have to do?

@LittleFox94
Copy link
Contributor Author

/retest

@LittleFox94
Copy link
Contributor Author

Please take another look @andrewsykim, @deads2k or @wlan0

Tests ran successfully, now only needs another look at the code and hopefully merge :)

Thanks :)

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 5, 2022
@LittleFox94 LittleFox94 force-pushed the cloud-provider/logging-format branch from e916ff9 to c37723a Compare May 5, 2022 13:47
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 5, 2022
@LittleFox94 LittleFox94 force-pushed the cloud-provider/logging-format branch 2 times, most recently from afe88c0 to 82edb64 Compare May 6, 2022 08:30
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 19, 2023
@LittleFox94
Copy link
Contributor Author

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?

@pohly
Copy link
Contributor

pohly commented Jan 19, 2023

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.

Copy link
Contributor

@pohly pohly left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 19, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 90d9738091b998974527ccccb19176fd9db378d3

Copy link
Member

@andrewsykim andrewsykim left a 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 {
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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)
Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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?

Copy link
Member

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

@andrewsykim
Copy link
Member

/hold

(holding for the question on feature gates)

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 19, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 19, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 21, 2023
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.
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 23, 2023
Copy link
Member

@andrewsykim andrewsykim left a 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

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Feb 6, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f31d383e5beeedf2a651ff8c4a2be417bbccc325

@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot merged commit 31d6d9a into kubernetes:master Feb 6, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.27 milestone Feb 6, 2023
@LittleFox94 LittleFox94 deleted the cloud-provider/logging-format branch February 6, 2023 18:16
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. area/cloudprovider area/dependency Issues or PRs related to dependency changes 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

9 participants