-
Notifications
You must be signed in to change notification settings - Fork 200
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
fix(webhook): reject PVC deletion request when dependent snapshots exists #1669
fix(webhook): reject PVC deletion request when dependent snapshots exists #1669
Conversation
…ists Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
…esnapshot.external-storage.k8s.io Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
snapshotDataList, err := wh.snapClientSet. | ||
VolumesnapshotV1(). | ||
VolumeSnapshotDatas(). | ||
List(metav1.ListOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not remember exactly , does VolumeSnapshotData
not have any PV based label ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description already has an example to make easy reviews
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i can see that you have added the full SnapshotData resources ( it was not there before when i reviewed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metadata added later.
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
sai@sai:~/gocode/src/github.com/openebs/maya/tests/cstor/snapshot$ ginkgo -v -- -kubeconfig=/var/run/kubernetes/admin.kubeconfig -cstor-maxpools=1 -cstor-replicas=1
Running Suite: Test cstor volume snapshot provisioning
======================================================
Random Seed: 1586967695
Will run 1 of 1 specs
STEP: waiting for maya-apiserver pod to come into running state
STEP: waiting for openebs-provisioner pod to come into running state
STEP: Verifying 'admission-server' pod status as running
STEP: building a namespace
STEP: creating a namespace
[cstor] TEST SNAPSHOT PROVISIONING when cstor pvc with replicacount n is created
should create cstor volume target pod
/home/sai/gocode/src/github.com/openebs/maya/tests/cstor/snapshot/snapshot_test.go:96
STEP: building spc object
STEP: creating storagepoolclaim
STEP: verifying healthy csp count
STEP: building a CAS Config with generated SPC name
STEP: building storageclass object
STEP: creating storageclass
STEP: building a persistentvolumeclaim
STEP: creating cstor persistentvolumeclaim
STEP: verifying volume target pod count as 1
STEP: verifying cstorvolume replica count
STEP: verifying pvc status as bound
STEP: building a cstor volume snapshot
STEP: creating cstor volume snapshot
STEP: verifying snapshot status as ready
STEP: Deleting PersistentVolumeClaim Should Reject the Request Because Of Snapshot Existence
STEP: deleting cstor volume snapshot
STEP: verifying deleted snapshot
STEP: Verifying deletion of snapshotdata
STEP: deleting above pvc
STEP: verifying target pod count as 0
STEP: verifying deleted pvc
STEP: verifying if cstorvolume is deleted
STEP: deleting resources created for cstor volume snapshot provisioning
STEP: deleting storagepoolclaim
STEP: deleting storageclass
• [SLOW TEST:111.625 seconds]
[cstor] TEST SNAPSHOT PROVISIONING
/home/sai/gocode/src/github.com/openebs/maya/tests/cstor/snapshot/snapshot_test.go:36
when cstor pvc with replicacount n is created
/home/sai/gocode/src/github.com/openebs/maya/tests/cstor/snapshot/snapshot_test.go:95
should create cstor volume target pod
/home/sai/gocode/src/github.com/openebs/maya/tests/cstor/snapshot/snapshot_test.go:96
------------------------------
STEP: deleting namespace
Ran 1 of 1 Specs in 111.682 seconds
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS
Ginkgo ran 1 suite in 1m57.727257024s
Test Suite Passed
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does / why we need it:
This PR rejects the PVC deletion request when the snapshot exists for the corresponding volume.
When VolumeSnapshot/VolumeSnapshotData exist for particular volume then the deletion of PVC will be errored with the following message
Note:
Sample SnapshotExample which will help for reviewers:
volumesnapshot example:
VolumeSnapshotData example:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #openebs/openebs#2994Release Note:
Special notes for your reviewer:
Checklist:
documentation
tagbreaking-changes
tagrequires-upgrade
tag