Skip to content

WIP - use logger from ctx instead of scope #1861

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

Closed
wants to merge 1 commit into from

Conversation

EmilienM
Copy link
Contributor

@EmilienM EmilienM commented Feb 5, 2024

What this PR does / why we need it:

Wwe create a cached provider scope and we put the logger in it. This has caused issue #1840 so now we'll get the logger from context.

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 #1840

TODOs:

  • squashed commits
  • if necessary:
    • includes documentation
    • adds unit tests

/hold

@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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 5, 2024
Copy link

netlify bot commented Feb 5, 2024

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit 8af919d
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/65c3dd9a30d3ac000884acda
😎 Deploy Preview https://deploy-preview-1861--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot requested review from dulek and mdbooth February 5, 2024 21:08
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 5, 2024
@EmilienM
Copy link
Contributor Author

EmilienM commented Feb 5, 2024

Before doing other files, I want to see the impact on the openstackcluster controller logs and if that changed anything.

@jichenjc
Copy link
Contributor

jichenjc commented Feb 7, 2024

/test pull-cluster-api-provider-openstack-e2e-test

Copy link
Contributor

@mdbooth mdbooth left a comment

Choose a reason for hiding this comment

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

This looks great, and has the added advantage of starting to proliferate ctx most places.

Just the note about not losing explicit log levels when we make this change.

@@ -491,7 +496,7 @@ func reconcileNetworkComponents(scope scope.Scope, cluster *clusterv1.Cluster, o
}

if openStackCluster.Spec.NodeCIDR == "" {
scope.Logger().V(4).Info("No need to reconcile network, searching network and subnet instead")
log.Info("No need to reconcile network, searching network and subnet instead")
Copy link
Contributor

Choose a reason for hiding this comment

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

Caution when you're making all these mechanical changes: please don't lose the .V(n) bit.

Suggested change
log.Info("No need to reconcile network, searching network and subnet instead")
log.V(4).Info("No need to reconcile network, searching network and subnet instead")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh right, thanks.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 7, 2024
Copy link
Contributor

@huxcrux huxcrux 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 Feb 8, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: EmilienM, huxcrux
Once this PR has been reviewed and has the lgtm label, please assign lentzi90 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link
Contributor

PR needs rebase.

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2024
@mdbooth
Copy link
Contributor

mdbooth commented Feb 28, 2024

@EmilienM you mentioned you weren't happy with how invasive this change became. Based on that feedback I created #1913, which is less invasive because it doesn't require changing the Logger() calls. Do you want to close this PR?

I feel like we're likely to end up touching all of this stuff anyway, e.g. to pass Context everywhere in Gophercloud v2. I also think this highlights a design smell in Scope (logger probably shouldn't be in there). Still, I'll be glad not to do that work today.

@EmilienM
Copy link
Contributor Author

/close

@k8s-ci-robot
Copy link
Contributor

@EmilienM: Closed this PR.

In response to this:

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

controller/openstackcluster: reconcileID is re-used 1000+ times
5 participants