feat(garbage-collector): garbage-collector to remove stale NFS resouces#80
Merged
kmova merged 7 commits intoopenebs-archive:developfrom Aug 9, 2021
Merged
feat(garbage-collector): garbage-collector to remove stale NFS resouces#80kmova merged 7 commits intoopenebs-archive:developfrom
kmova merged 7 commits intoopenebs-archive:developfrom
Conversation
added 3 commits
July 28, 2021 18:57
…ces.
Garbage collector runs at an interval of 5 minutes and checks the PVC(backend PVC) created by the nfs-provisioner in the nfs-server namespace.
Garbage collector process the PVC from nfs-server namespace having a label "openebs.io/cas-type=nfs-kernel".
To map the backend PVC to NFS PVC(created by a user to provision NFS PV), provisioner adds the following labels to the backend PVC.
- nfs.openebs.io/nfs-pvc-name: <nfs-pvc-name>
- nfs.openebs.io/nfs-pvc-namespace: <nfs-pvc-ns>
- nfs.openebs.io/nfs-pvc-uid: <nfs-pvc-uid>
If backend PVC is missing any label from the above list, then the garbage collector will not process that backend PVC.
If relevant NFS PVC(nfs-pvc-ns/nfs-pvc-name) exists in cluster and having UID value <nfs-pvc-uid> or, garbage collector couldn't find
the relevant NFS PVC due to network/permission issues, then garbage collector will not perform clean-up for that backend PVC.
If relevant NFS PVC doesn't exist for the backend PVC then the garbage collector will check for the relevant NFS PV resource to process the backend PVC.
If NFS PV resource doesn't exist then the garbage collector will remove the resources created for NFS PV, i.e Service, Deployment, backend PVC.
If NFS PV exists for the backend PVC then the garbage collector will not remove the resources for that PV.
--
This commit also modifies the NFS-Provisioner provisioning behavior. While provisioning, the provisioner will wait for 1 minute
to bound backend PVC(created by provisioner for NFS PV). If backend PVC is not bound within 1 minute period then provisioner will
return an error "timed out waiting for PVC{ns/name} to bound".
Signed-off-by: mayank <mayank.patel@mayadata.io>
Signed-off-by: mayank <mayank.patel@mayadata.io>
Signed-off-by: mayank <mayank.patel@mayadata.io>
Codecov Report
@@ Coverage Diff @@
## develop #80 +/- ##
===========================================
+ Coverage 45.19% 46.99% +1.79%
===========================================
Files 27 29 +2
Lines 2239 2349 +110
===========================================
+ Hits 1012 1104 +92
- Misses 1157 1167 +10
- Partials 70 78 +8
Continue to review full report at Codecov.
|
added 3 commits
July 29, 2021 14:05
- TEST NFS PROVISIONER WITH INVALID BACKEND SC
Old behaviour:
- Create NFS PVC with NFS SC having invalid Backend SC
- Wait for NFS PVC to bound
- Check nfs-server pod should be in pending state
- Check backend-pvc in pending state
New behaviour:
- Create NFS PVC with NFS SC having invalid Backend SC
- Check NFS PVC is in pending state
Signed-off-by: mayank <mayank.patel@mayadata.io>
Signed-off-by: mayank <mayank.patel@mayadata.io>
Signed-off-by: mayank <mayank.patel@mayadata.io>
mittachaitu
reviewed
Jul 30, 2021
Contributor
mittachaitu
left a comment
There was a problem hiding this comment.
Provided few comments... rest of changes looks good to me
Comment on lines
-104
to
-105
| When("verifying nfs-server state", func() { | ||
| It("should have nfs-server in pending state", func() { |
Contributor
There was a problem hiding this comment.
Q: Even with the changes nfs-server deployment will be created right? Why do we need to remove this?
Contributor
Author
There was a problem hiding this comment.
Due to a timing issue. The same behavior is added in TEST GARBAGE COLLECTION OF NFS RESOURCES.
Signed-off-by: mayank <mayank.patel@mayadata.io>
kmova
approved these changes
Aug 9, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: mayank mayank.patel@mayadata.io
Why is this PR required? What issue does it fix?:
This PR fixes #79.
What this PR does?:
This PR adds garbage collector to remove stale nfs resources. Garbage collector runs at an interval of 5 minutes and checks the PVC(backend PVC) created by the nfs-provisioner in the nfs-server namespace. Garbage collector process the PVC from nfs-server namespace having a label "openebs.io/cas-type=nfs-kernel".
To map the backend PVC to NFS PVC(created by a user to provision NFS PV), provisioner adds the following labels to the backend PVC.
If backend PVC is missing any label from the above list, then the garbage collector will not process that backend PVC.
If relevant NFS PVC(nfs-pvc-ns/nfs-pvc-name) exists in cluster and having UID value or, garbage collector couldn't find
the relevant NFS PVC due to network/permission issues, then garbage collector will not perform clean-up for that backend PVC.
If relevant NFS PVC doesn't exist for the backend PVC then the garbage collector will check for the relevant NFS PV resource to process the backend PVC.
If NFS PV resource doesn't exist then the garbage collector will remove the resources created for NFS PV, i.e Service, Deployment, backend PVC.
If NFS PV exists for the backend PVC then the garbage collector will not remove the resources for that PV.
This PR also modifies the NFS-Provisioner provisioning behavior. While provisioning, the provisioner will wait for 1 minute to bound backend PVC(created by provisioner for NFS PV). If backend PVC is not bound within 1 minute period then provisioner will return an error
timed out waiting for PVC{ns/name} to bound.Does this PR require any upgrade changes?: No
If the changes in this PR are manually verified, list down the scenarios covered::
Any additional information for your reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs
Checklist:
<type>(<scope>): <subject>