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

Correct snapshotContent error propagation #502

Merged

Conversation

huffmanca
Copy link
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:
Currently if we fail to create a snapshot in a CSIFinalError way, the error is overwritten when we attempt to remove the annotation on the content. This can result in the snapshot controller logging the error, but subsequent logs (and events) being nil:

I0420 18:59:30.106430 1 snapshot_controller.go:301] createSnapshotWrapper: CreateSnapshot for content snapcontent-5e494f19-ea35-480c-89f8-626e6ad1dbd3 returned error: rpc error: code = Unknown desc = AzureDisk - invalid option invalid in VolumeSnapshotClass
...
E0420 18:59:30.506775 1 snapshot_controller.go:105] createSnapshot for content [snapcontent-5e494f19-ea35-480c-89f8-626e6ad1dbd3]: error occurred in createSnapshotWrapper: failed to take snapshot of the volume, ...%!q()

We don't see any Events with the correct error logged. By changing the error we're able to get the events correctly created. There are still periodic issues with stale resources, but these are addressed by changing to Patch (or by performing a Get in updateContentErrorStatusWithEvent). These changes are being made in #480 , and therefore I didn't include them here.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

VolumeSnapshotContent creation errors can now propagate to the appropriate VolumeSnapshotContent resource.

@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. labels Apr 21, 2021
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 21, 2021
@@ -300,8 +300,8 @@ func (ctrl *csiSnapshotSideCarController) createSnapshotWrapper(content *crdv1.V
// storage system has responded with an error
klog.Infof("createSnapshotWrapper: CreateSnapshot for content %s returned error: %v", content.Name, err)
if isCSIFinalError(err) {
if err := ctrl.removeAnnVolumeSnapshotBeingCreated(content); err != nil {
return nil, fmt.Errorf("failed to remove VolumeSnapshotBeingCreated annotation from the content %s: %s", content.Name, err)
if remoteAnnotationErr := ctrl.removeAnnVolumeSnapshotBeingCreated(content); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remoteAnnotationErr -> removeAnnotationErr

err != nil -> remoteAnnotationErr != nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies. This has been fixed.

@xing-yang
Copy link
Collaborator

/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 Apr 22, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: huffmanca, xing-yang

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 Apr 22, 2021
@k8s-ci-robot k8s-ci-robot merged commit dc7908e into kubernetes-csi:master Apr 22, 2021
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.

None yet

3 participants