Skip to content

Allow creation of snapshot content if pvc finalizer exists, even if pvc is marked for deletion.#413

Merged
k8s-ci-robot merged 1 commit intokubernetes-csi:masterfrom
RaunakShah:pvcfinalizer_fix
Oct 31, 2020
Merged

Allow creation of snapshot content if pvc finalizer exists, even if pvc is marked for deletion.#413
k8s-ci-robot merged 1 commit intokubernetes-csi:masterfrom
RaunakShah:pvcfinalizer_fix

Conversation

@RaunakShah
Copy link
Copy Markdown
Contributor

@RaunakShah RaunakShah commented Oct 30, 2020

What type of PR is this?
/kind bug

What this PR does / why we need it:
Currently there's a timing issue in createSnapshotContent which does not proceed if a PVC is marked for deletion, irrespective of whether the PVCFinalizer already exists on the PVC.
The result is that the PVC will remain in Terminating state and VolumeSnapshot.ReadyToUse will be false infinitely.

$ kubectl get pvc -A
NAMESPACE               NAME       STATUS        VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                                                   AGE
csi-mock-volumes-6032   test-pvc   Terminating   pvc-d2b09880-89ea-42a0-9896-c1159b35f349   2Gi        RWO            csi-mock-volumes-6032-csi-mock-csi-mock-volumes-6032-scczwbv   4m
$ kubectl get volumesnapshot -A
NAMESPACE               NAME             READYTOUSE   SOURCEPVC   SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS                                              SNAPSHOTCONTENT   CREATIONTIME   AGE
csi-mock-volumes-6032   snapshot-ssd5d   false        test-pvc                                          csi-mock-volumes-6032-csi-mock-csi-mock-volumes-6032-vsc                                    4m3s

This change returns success if the PVC Finalizer exists. If it doesnt exist, we check for deletionTimestamp before adding the finalizer.

Steps to reproduce:

  1. Create Snapshot and PVC together
  2. Delete PVC before Snapshot.ReadyToUse is true

Which issue(s) this PR fixes:

Fixes #349

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Bug fix to allow creation of snapshot content if pvc finalizer exists, even if pvc is marked for deletion.

@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 Oct 30, 2020
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 30, 2020
@RaunakShah
Copy link
Copy Markdown
Contributor Author

/assign @xing-yang

@xing-yang
Copy link
Copy Markdown
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 Oct 31, 2020
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 Oct 31, 2020
@k8s-ci-robot k8s-ci-robot merged commit 23b415b into kubernetes-csi:master Oct 31, 2020
k8s-ci-robot added a commit that referenced this pull request Oct 31, 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 Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VolumeSnapshot cannot be deleted

3 participants