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

⚠️ Update klog dependency to v2 #4284

Merged
merged 4 commits into from
Mar 13, 2021

Conversation

stmcginnis
Copy link
Contributor

What this PR does / why we need it:
This switches klog usage over to klog v2.5.0 to match the current
version being used in k/k.

This should also address some issues we're seeing that have since been
fixed in klog between the quite old v1.0.0 and v2.5.0

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #3763

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 10, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @stmcginnis!

It looks like this is your first PR to kubernetes-sigs/cluster-api 🎉. 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-sigs/cluster-api 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 10, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @stmcginnis. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 10, 2021
@neolit123
Copy link
Member

/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 10, 2021
@neolit123
Copy link
Member

cc @enyinna1234

@neolit123
Copy link
Member

i didn't check the CI errors here, but you are probably going to have to update the go.mod/sum files too.

@stmcginnis
Copy link
Contributor Author

Yep, go.mod and go.sum are included here. Need to look through them all, but first one looks like maybe a pull error. Maybe something going on causing them all to fail?

Will investigate.

@vincepri
Copy link
Member

We should move controller runtime first to klog v2, if we haven't already.

@detiber
Copy link
Member

detiber commented Mar 10, 2021

We should move controller runtime first to klog v2, if we haven't already.

I don't think controller-runtime uses klog directly, only github.com/go-logr/logr and zap. I'd expect anything using klog would be through transitive dependencies.

@stmcginnis
Copy link
Contributor Author

Thanks @vincepri and @detiber. From my understanding, this should be fine. But I'm still pretty new to the code, so if there is anywhere else I should look to verify things or get other parts updated, just let me know. Happy to take a look!

@stmcginnis
Copy link
Contributor Author

Indeed, it would appear controller-runtime had already switch to klog v2:

https://github.com/kubernetes-sigs/controller-runtime/blob/85527dfb53483d218ce87733abd3093b1c05c618/go.sum#L795

@stmcginnis
Copy link
Contributor Author

/test pull-cluster-api-test-main

Appears to have hit #4184

@detiber
Copy link
Member

detiber commented Mar 10, 2021

Running make modules should clean up the error in the pull-cluster-api-verify job

@stmcginnis
Copy link
Contributor Author

Thanks! Looks like that didn't do it though - pretty much had run those manually. Glad to know about it though.

Looks like I may need to run make generate? Will see once it finally finishes running.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 10, 2021
@stmcginnis
Copy link
Contributor Author

Hah, I take that back. Running make modules initially didn't show any local changes for me. But after reverting this apparently very bad make generate changes, I ran it again and now it does actually show a change in test/infrastructure/docker/go.sum. 🤷

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 10, 2021
@vincepri
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2021
@vincepri
Copy link
Member

/milestone v0.4.0
/retitle ⚠️ Update klog dependency to v2

@stmcginnis
Copy link
Contributor Author

It's my understanding that it should not have an impact on providers. klog and klogv2 should be able to be used together, it's just the path through the code that consuming code will take to ultimately get to the logging.

@CecileRobertMichon
Copy link
Contributor

@vincepri why did you mark the change as breaking?

@vincepri
Copy link
Member

It'd be great actually if we document that we've switched to v2 (hence my marking this PR as ⚠️). When mixed, klog's flags are not going to work across packages. For example, logtostderr or log to file, and any other flag (even verbosity) would only be respected for the flags that are being registered in the main.go, while the rest of the codebase is going to use what's the default.

Hope the above example makes sense, happy to provide more details.

@stmcginnis
Copy link
Contributor Author

Oh, great point @vincepri, I hadn't thought of that.

Where should this be documented? Happy to add some notification about the v2 requirement. I see docs/developer, but that currently only has release information.

I will also look at proposing updates to any of the other upstream cluster-api-* repos.

@CecileRobertMichon
Copy link
Contributor

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Mar 11, 2021
This switches klog usage over to klog v2.5.0 to match the current
version being used in k/k.

This should also address some issues we're seeing that have since been
fixed in klog between the quite old v1.0.0 and v2.5.0

Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Missed updating the go.mod file in test/infrastructure/docker/go.mod to
match upgrading the rest of the repo to use klog v2.

Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This updates the v1alpha3-to-v1alpha4 docs to call out the move to
klogv2 and recommending that all cluster providers do the same.

Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 12, 2021
@vincepri vincepri added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 13, 2021
Copy link
Member

@vincepri vincepri 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

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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 Mar 13, 2021
@k8s-ci-robot k8s-ci-robot merged commit 345d392 into kubernetes-sigs:master Mar 13, 2021
@stmcginnis stmcginnis deleted the klogv2 branch March 13, 2021 00:25
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid ProviderID error is malformed
6 participants