[release-1.32] Migrate to contextual logging#9810
Conversation
|
Hi @anndono. Thanks for your PR. I'm waiting for a github.com 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. DetailsInstructions 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-sigs/prow repository. |
|
/ok-to-test |
There was a problem hiding this comment.
Pull request overview
This PR migrates the codebase from traditional klog logging to contextual logging using the sigs.k8s.io/cloud-provider-azure/pkg/log package. The migration standardizes logging across the codebase by:
- Replacing
k8s.io/klog/v2imports withsigs.k8s.io/cloud-provider-azure/pkg/log - Converting from format string logging (e.g.,
klog.Infof()) to structured logging with key-value pairs - Adding logger instances with descriptive names to functions
- Ensuring proper context propagation using
FromContextOrBackgroundorBackgroundmethods
Key Changes
- Migrated logging calls from klog to contextual logging with structured key-value pairs
- Replaced
klog.Fatalf()withlogger.Error()+klog.FlushAndExit()pattern - Updated error logging to use
logger.Error(err, "message", key, value)format
Reviewed changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e/utils/kustoIngest.go | Migrated Kusto ingestion logging to contextual logging |
| tests/e2e/e2e_test.go | Updated test logging with structured format |
| pkg/windows/service/service.go | Migrated Windows service logging |
| pkg/util/node/node.go | Updated node utility logging |
| pkg/util/controller/testutil/test_utils.go | Migrated test utility logging with context parameter |
| pkg/util/controller/node/controller_utils.go | Updated node controller utility logging |
| pkg/provider/subnet/subnet.go | Migrated subnet repository logging |
| pkg/provider/storage/* | Updated storage-related logging across multiple files |
| pkg/provider/securitygroup/azure_securitygroup_repo.go | Migrated security group repository logging |
| pkg/provider/azure_zones.go | Updated zone management logging |
| pkg/provider/azure_vmss*.go | Migrated VMSS-related logging across cache, repository, and controller files |
| pkg/provider/azure_standard.go | Updated availability set logging |
| pkg/provider/azure_routes.go | Migrated route management logging |
| pkg/provider/azure_publicip_repo.go | Updated public IP repository logging |
| pkg/provider/azure_privatelinkservice.go | Migrated private link service logging |
| pkg/provider/azure_lock.go | Updated distributed lock logging |
| pkg/provider/azure_local_services.go | Migrated local services logging |
| pkg/provider/azure_loadbalancer*.go | Updated load balancer logging across multiple files |
| pkg/provider/azure_interface_repo.go | Migrated network interface repository logging |
| pkg/provider/azure_instances*.go | Updated instance management logging |
| pkg/provider/azure_instance_metadata.go | Migrated instance metadata service logging |
| pkg/provider/azure_controller*.go | Updated controller logging |
| pkg/nodeipam/node_ipam_controller.go | Migrated node IPAM controller logging |
| pkg/nodeipam/ipam/cidrset/cidr_set_test.go | Updated test logging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/retest |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: anndono, nilo19 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Cherry pick of logging migration(#9664 , #9707 , #9773 , #9778 ): This standardizes logging by migrating from a mix of plaintext and structured logging to contextual logging, improving consistency, clarity, and observability across the codebase.
Which issue(s) this PR fixes:
Fixes #
ref: #1575
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: