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

Get credentials before checking if the SnapshotClass exists #423

Merged

Conversation

huffmanca
Copy link
Contributor

@huffmanca huffmanca commented Nov 6, 2020

What type of PR is this?
/kind bug

What this PR does / why we need it:
If a CSIDriver requires credentials, but the VolumeSnapshotClass has been deleted, then the VolumeSnapshotContent cannot be deleted even though it contains a reference to the credentials in its own annotations.

This PR grabs the credentials instead of checking to see if the VolumeSnapshotClass exists, so that we can delete VolumeSnapshotContent objects if the secret annotation is on the VolumeSnapshotContent.

Which issue(s) this PR fixes:
Fixes #412

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Nov 6, 2020
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 6, 2020
// that the content can be deleted if this class no longer exists.
snapshotterCredentials, err := ctrl.GetCredentialsFromAnnotation(content)
if err != nil {
return nil, nil, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will affect snapshot creation. We need to have SnapshotClass for snapshot creation.

Instead of making changes to getCSISnapshotInput, we can make a change in deleteCSISnapshotOperation.
Replace the call _, snapshotterCredentials, err := ctrl.getCSISnapshotInput(content) with snapshotterCredentials, err := ctrl.GetCredentialsFromAnnotation(content) as we only need to get credentials from annotation at delete snapshot time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the quick review! I'll make the changes now.

@huffmanca huffmanca force-pushed the adjust-content-deletion branch from 28dad41 to 60c478e Compare November 6, 2020 20:24
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 6, 2020
@xing-yang
Copy link
Collaborator

Can you update the PR description?

@huffmanca
Copy link
Contributor Author

This has been done.

@huffmanca huffmanca force-pushed the adjust-content-deletion branch from 60c478e to 0f3fa91 Compare November 6, 2020 20:43
@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 Nov 6, 2020
@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 Nov 6, 2020
@k8s-ci-robot k8s-ci-robot merged commit e56a75b into kubernetes-csi:master Nov 6, 2020
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-none Denotes a PR that doesn't merit a release note. 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.

Failed to delete volumesnapshot if the volumesnapshotclass is deleted
3 participants