Skip to content

Upgrade klog v1 to v2 and fix error wrapping #1084

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

Merged

Conversation

sunnylovestiramisu
Copy link
Contributor

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change

/kind bug

/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
Simiar to gcp-filestore-csi-driver/pr/381. In V1 klog.Errorf does not support %w but we need to unwrap the error correctly.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:
NONE


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 18, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @sunnylovestiramisu. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 18, 2022
@saikat-royc
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 Nov 18, 2022
@sunnylovestiramisu sunnylovestiramisu force-pushed the fixPDCSIErrorWrap branch 2 times, most recently from 9583d92 to 3683e08 Compare November 19, 2022 00:29
@sunnylovestiramisu
Copy link
Contributor Author

/retest

@sunnylovestiramisu
Copy link
Contributor Author

Verified integration test logs:

Pod log: http://shortn/_YyBlskh1D6

klog.V(4).Infof("NodePublishVolume succeeded on volume...)
klog.Errorf("Failed to disabled device...)

@sunnylovestiramisu sunnylovestiramisu marked this pull request as ready for review November 21, 2022 18:45
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 21, 2022
@msau42
Copy link
Contributor

msau42 commented Nov 21, 2022

It looks like the pdcsi driver doesn't have the same isUserError logic that filestore has and it is returning Internal error code in a lot of places:

return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume failed to create single zonal disk %#v: %v", name, err))

So I think this PR can concentrate on switching to klog v2, but there is more work required to propagate user error codes.

@sunnylovestiramisu
Copy link
Contributor Author

Will address that in another pr, this is converting klog to klogv2 so we can use %w. A lot of these fmt.Sprintf errors got kloged with %v before reaching this step.

@msau42
Copy link
Contributor

msau42 commented Nov 22, 2022

/lgtm
/approve
/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 22, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 22, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: msau42, sunnylovestiramisu

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 Nov 22, 2022
@k8s-ci-robot k8s-ci-robot merged commit ea3b93c into kubernetes-sigs:master Nov 22, 2022
@sunnylovestiramisu sunnylovestiramisu deleted the fixPDCSIErrorWrap branch November 29, 2022 17:53
k8s-ci-robot added a commit that referenced this pull request Jan 23, 2023
…k-of-#1073-#1084-#1092-upstream-release-1.8

Automated cherry pick of #1073: Add debugging log for the mapping of a PD name to /dev/* path
#1084: Upgrade klog v1 to v2 and fix error wrapping
#1092: Separate user errors from internal errors
@k8s-infra-cherrypick-robot

@sunnylovestiramisu: cannot checkout branch-1.7: error checking out branch-1.7: exit status 1. output: error: pathspec 'branch-1.7' did not match any file(s) known to git

In response to this:

/cherry-pick branch-1.7

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.

@sunnylovestiramisu
Copy link
Contributor Author

/cherry-pick release-1.7

@k8s-infra-cherrypick-robot

@sunnylovestiramisu: #1084 failed to apply on top of branch "release-1.7":

Applying: Upgrade klog v1 to v2 and fix error wrapping
Using index info to reconstruct a base tree...
M	cmd/gce-pd-csi-driver/main.go
M	go.mod
M	go.sum
M	pkg/gce-cloud-provider/compute/fake-gce.go
M	pkg/gce-cloud-provider/compute/gce-compute.go
M	pkg/gce-cloud-provider/compute/gce.go
M	pkg/gce-pd-csi-driver/controller.go
M	pkg/gce-pd-csi-driver/node.go
M	pkg/mount-manager/device-utils.go
M	pkg/mount-manager/safe-mounter-v1_windows.go
M	pkg/mount-manager/safe-mounter-v1beta_windows.go
M	pkg/resizefs/resizefs_linux.go
M	test/e2e/tests/resize_e2e_test.go
M	test/e2e/tests/setup_e2e_test.go
M	test/e2e/tests/single_zone_e2e_test.go
M	test/e2e/utils/utils.go
M	test/k8s-integration/main.go
M	test/k8s-integration/version.go
M	vendor/modules.txt
Falling back to patching base and 3-way merge...
Auto-merging vendor/modules.txt
CONFLICT (content): Merge conflict in vendor/modules.txt
Removing vendor/k8s.io/klog/klog_file.go
Removing vendor/k8s.io/klog/klog.go
Removing vendor/k8s.io/klog/code-of-conduct.md
Removing vendor/k8s.io/klog/SECURITY_CONTACTS
Removing vendor/k8s.io/klog/RELEASE.md
Removing vendor/k8s.io/klog/README.md
Removing vendor/k8s.io/klog/OWNERS
Removing vendor/k8s.io/klog/LICENSE
Removing vendor/k8s.io/klog/CONTRIBUTING.md
Removing vendor/k8s.io/klog/.travis.yml
Auto-merging test/k8s-integration/version.go
Auto-merging test/k8s-integration/main.go
Auto-merging test/e2e/utils/utils.go
CONFLICT (content): Merge conflict in test/e2e/utils/utils.go
Auto-merging test/e2e/tests/single_zone_e2e_test.go
CONFLICT (content): Merge conflict in test/e2e/tests/single_zone_e2e_test.go
Auto-merging test/e2e/tests/setup_e2e_test.go
Auto-merging test/e2e/tests/resize_e2e_test.go
Auto-merging pkg/resizefs/resizefs_linux.go
Auto-merging pkg/mount-manager/safe-mounter-v1beta_windows.go
Auto-merging pkg/mount-manager/safe-mounter-v1_windows.go
Auto-merging pkg/mount-manager/device-utils.go
Auto-merging pkg/gce-pd-csi-driver/node.go
CONFLICT (content): Merge conflict in pkg/gce-pd-csi-driver/node.go
Auto-merging pkg/gce-pd-csi-driver/controller.go
Auto-merging pkg/gce-cloud-provider/compute/gce.go
Auto-merging pkg/gce-cloud-provider/compute/gce-compute.go
Auto-merging pkg/gce-cloud-provider/compute/fake-gce.go
Auto-merging go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
Auto-merging cmd/gce-pd-csi-driver/main.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Upgrade klog v1 to v2 and fix error wrapping
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.7

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 added a commit that referenced this pull request May 10, 2023
…k-of-#1084-upstream-release-1.7

Automated cherry pick of #1084: Upgrade klog v1 to v2 and fix error wrapping
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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants