Skip to content

Reassign error returned from validateStoragePools so InvalidArgument is recorded #1710

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

amacaskill
Copy link
Member

@amacaskill amacaskill commented May 15, 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:
Reassign error returned from validateStoragePools so InvalidArgument is recorded. Currently, since the error is not reassigned to have the InvalidArgumentCode, when defer gceCS.Metrics.RecordOperationErrorMetrics("CreateVolume", err, diskTypeForMetric, enableConfidentialCompute, enableStoragePools) is executed, it passes an error that looks like fmt.Errorf("error") to RecordOperationErrorMetrics, which is technically an Internal error.

I'm fixing this first for Storage Pools, but it looks like we have this issue in a lot of places. In some cases, we don't reassign the error at all, meaning defer gceCS.Metrics.RecordOperationErrorMetrics("CreateVolume", err, diskTypeForMetric, enableConfidentialCompute, enableStoragePools) will actually pass a nil error, resulting in a OK status CreateVolume call being reported to the operation error metric. In some places (like in the Storage Pools case), we reassign the err, but we add an error code onto the error before returning. This won't get recorded to RecordOperationErrorMetrics unless we actually reassign this error, or implement RecordOperationErrorMetrics in a different way.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Reassign error returned from validateStoragePools so InvalidArgument is recorded

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 15, 2024
@k8s-ci-robot k8s-ci-robot requested review from mattcary and tyuchn May 15, 2024 21:36
@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 15, 2024
…error code is recorded instead of internal error code
@amacaskill amacaskill force-pushed the operation-error-code-internal branch from 5ce3f25 to 8aec1f5 Compare May 15, 2024 21:37
@amacaskill
Copy link
Member Author

/assign @mattcary

@mattcary
Copy link
Contributor

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

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [amacaskill,mattcary]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@amacaskill
Copy link
Member Author

/retest

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 16, 2024
@amacaskill
Copy link
Member Author

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

@amacaskill
Copy link
Member Author

/easycla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 23, 2024
@k8s-ci-robot k8s-ci-robot merged commit 629ddec into kubernetes-sigs:master May 23, 2024
7 checks passed
@amacaskill
Copy link
Member Author

/cherry-pick release-1.13

@k8s-infra-cherrypick-robot

@amacaskill: new pull request created: #1721

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.

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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants