Skip to content

[release-1.32] Migrate to contextual logging#9810

Merged
k8s-ci-robot merged 13 commits intokubernetes-sigs:release-1.32from
anndono:chengan/cherry-pick-logging-migration-to-1-32
Jan 7, 2026
Merged

[release-1.32] Migrate to contextual logging#9810
k8s-ci-robot merged 13 commits intokubernetes-sigs:release-1.32from
anndono:chengan/cherry-pick-logging-migration-to-1-32

Conversation

@anndono
Copy link
Copy Markdown
Contributor

@anndono anndono commented Jan 5, 2026

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?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 5, 2026
@k8s-ci-robot k8s-ci-robot requested a review from lzhecheng January 5, 2026 23:28
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

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 /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.

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot requested a review from nilo19 January 5, 2026 23:28
@github-actions github-actions Bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 5, 2026
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 5, 2026
@nilo19
Copy link
Copy Markdown
Contributor

nilo19 commented Jan 6, 2026

/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 Jan 6, 2026
@nilo19 nilo19 requested a review from Copilot January 6, 2026 00:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/v2 imports with sigs.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 FromContextOrBackground or Background methods

Key Changes

  • Migrated logging calls from klog to contextual logging with structured key-value pairs
  • Replaced klog.Fatalf() with logger.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.

Comment thread pkg/provider/azure_loadbalancer_healthprobe.go
Comment thread pkg/provider/azure_loadbalancer_healthprobe.go
Comment thread pkg/provider/azure_lock.go
@nilo19
Copy link
Copy Markdown
Contributor

nilo19 commented Jan 6, 2026

/retest

@nilo19
Copy link
Copy Markdown
Contributor

nilo19 commented Jan 7, 2026

/lgtm
/approve

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

[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

Details 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 Jan 7, 2026
@k8s-ci-robot k8s-ci-robot merged commit 2e3b704 into kubernetes-sigs:release-1.32 Jan 7, 2026
28 checks passed
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ 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.

4 participants