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

Properly unwrap gce-compute error code. #1708

Merged
merged 1 commit into from
May 29, 2024

Conversation

hime
Copy link
Member

@hime hime commented May 14, 2024

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:
A new way of wrapping errors was introduced in compute engine API (eg. "cloud.service.Disks.Insert") where some of these errors are wrapped with an additional layer of googleapi.Error. This additional wrap does not contain the http error code in its error code field, but instead contains a default value of Unknown. This is problematic because one of the ways we extract errors is by checking if the error can be a status (signifying a temporary error instead). The way the error is structured allows it to be classified as temporary, which causes our code to return the Unknown error present in the outermost layer, before any other error checks occur.

This has been causing issues in how we report errors coming from compute engine, since we do not currently unwrap them properly, resulting in Unknown error code being reported in most scenarios. This PR ensures we are unwrapping the embedded error code properly while making sure all the other error types we encounter continue to process errors as expected.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Error codes extracted from errors part of compute engine api are now exposed with correct http errors instead of being classified as Unknown.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 14, 2024
Copy link

linux-foundation-easycla bot commented May 14, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: hime / name: Jaime (384acf8)

@k8s-ci-robot k8s-ci-robot added 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: no Indicates the PR's author has not signed the CNCF CLA. labels May 14, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @hime!

It looks like this is your first PR to kubernetes-sigs/gcp-compute-persistent-disk-csi-driver 🎉. 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/gcp-compute-persistent-disk-csi-driver 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 May 14, 2024
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 14, 2024
@amacaskill
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 14, 2024
@hime hime marked this pull request as ready for review May 15, 2024 00:01
@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 May 15, 2024
@k8s-ci-robot k8s-ci-robot requested a review from tyuchn May 15, 2024 00:01
@hime hime force-pushed the master branch 3 times, most recently from 5c73d4b to 9c6fea5 Compare May 15, 2024 06:52
@hime
Copy link
Member Author

hime commented May 15, 2024

/test pull-gcp-compute-persistent-disk-csi-driver-kubernetes-integration

@mattcary
Copy link
Contributor

Please add a release not -- it will make backporting of this change a lot easier. Thanks!

@amacaskill
Copy link
Member

/test pull-gcp-compute-persistent-disk-csi-driver-kubernetes-integration

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 May 23, 2024
test/e2e/tests/single_zone_e2e_test.go Outdated Show resolved Hide resolved
pkg/common/utils.go Outdated Show resolved Hide resolved
pkg/common/utils_test.go Outdated Show resolved Hide resolved
pkg/common/utils.go Outdated Show resolved Hide resolved
pkg/common/utils.go Outdated Show resolved Hide resolved
pkg/common/utils.go Outdated Show resolved Hide resolved
@hime hime closed this May 24, 2024
@k8s-ci-robot k8s-ci-robot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 24, 2024
@amacaskill
Copy link
Member

/retest

@hime hime closed this May 28, 2024
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 28, 2024
@hime hime reopened this May 28, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 28, 2024
pkg/common/utils.go Outdated Show resolved Hide resolved
@amacaskill
Copy link
Member

/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 May 29, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amacaskill, hime

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 May 29, 2024
@k8s-ci-robot k8s-ci-robot merged commit 4b2711b into kubernetes-sigs:master May 29, 2024
7 checks passed
@hime
Copy link
Member Author

hime commented Aug 26, 2024

/cherry-pick release-1.13

@hime
Copy link
Member Author

hime commented Aug 26, 2024

/cherry-pick release-1.12

@k8s-infra-cherrypick-robot

@hime: #1708 failed to apply on top of branch "release-1.13":

Applying: Properly unwrap gce-compute error code.
Using index info to reconstruct a base tree...
M	pkg/common/utils.go
M	pkg/common/utils_test.go
M	test/e2e/tests/single_zone_e2e_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/tests/single_zone_e2e_test.go
Auto-merging pkg/common/utils_test.go
Auto-merging pkg/common/utils.go
CONFLICT (content): Merge conflict in pkg/common/utils.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 Properly unwrap gce-compute error code.
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.13

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-infra-cherrypick-robot

@hime: #1708 failed to apply on top of branch "release-1.12":

Applying: Properly unwrap gce-compute error code.
Using index info to reconstruct a base tree...
M	pkg/common/utils.go
M	pkg/common/utils_test.go
M	test/e2e/tests/single_zone_e2e_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/tests/single_zone_e2e_test.go
Auto-merging pkg/common/utils_test.go
CONFLICT (content): Merge conflict in pkg/common/utils_test.go
Auto-merging pkg/common/utils.go
CONFLICT (content): Merge conflict in pkg/common/utils.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 Properly unwrap gce-compute error code.
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.12

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.

hime added a commit that referenced this pull request Sep 25, 2024
k8s-ci-robot added a commit that referenced this pull request Sep 26, 2024
…tream-release-1.12

Automated cherry pick of #1708: Properly unwrap gce-compute error code.
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 Denotes a PR that will be considered when it comes time to generate release notes. 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.

5 participants