-
Notifications
You must be signed in to change notification settings - Fork 99
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
lvm volume deletion is not idempotent leading to leak of lvmvolumes objects #15
Comments
I had planned to do this. Thanks for reporting this issue. Please go ahead and raise the pull request. |
iyashu
added a commit
to iyashu/lvm-localpv
that referenced
this issue
Feb 1, 2021
iyashu
added a commit
to iyashu/lvm-localpv
that referenced
this issue
Feb 1, 2021
7 tasks
iyashu
added a commit
to iyashu/lvm-localpv
that referenced
this issue
Feb 1, 2021
iyashu
added a commit
to iyashu/lvm-localpv
that referenced
this issue
Feb 1, 2021
iyashu
added a commit
to iyashu/lvm-localpv
that referenced
this issue
Feb 2, 2021
iyashu
added a commit
to iyashu/lvm-localpv
that referenced
this issue
Feb 2, 2021
Fixes openebs#15 Signed-off-by: Yashpal Choudhary <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What steps did you take and what happened:
Steps to reproduce -
kubectl delete pvc {claim-name}-{sf-name}-{index}
and wait till its removed.kubectl get lvmvol -n openebs
.You will observe that there are few lvmvolume objects hanging around, although the corresponding pvs are deleted.
What did you expect to happen:
Deletion of bounded pvc (pv) lead to eventual deletion of corresponding lvmvolume object.
The output of the following commands will help us better understand what's going on:
(Pasting long output into a GitHub gist or other Pastebin is fine.)
kubectl logs -f openebs-lvm-controller-0 -n kube-system -c openebs-lvm-plugin
kubectl logs -f openebs-lvm-node-[xxxx] -n kube-system -c openebs-lvm-plugin
kubectl get pods -n kube-system
kubectl get lvmvol -A -o yaml
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
As I'm deleting the bounded pvc object, sometimes the corresponding lvmvolume object (custom crd provided by openebs under local.openebs.io/v1alpha1) is not getting deleted. However, the actual logical volume created on the physical node gets deleted (as per
lsblk
orlvs
output), but the lvmvolume object gets struck.As one can see in above node agent logs, the controller is trying to delete non-existent lv without check if it's exists or not in first place. Since the lv deletion (as it doesn't exists) fails, the finalizer
lvm.openebs.io/finalizer
on lvmvol is not getting removed.lvm-localpv/pkg/mgmt/volume/volume.go
Line 81 in 3fe8d61
Now you may be wondering why one ended up in this situation where lv doesn't exists and the controller is trying to delete it. Reason being the failure of finalizer removal during the first syncVol call. As one can see from above node agent logs that while removing the finalizer (
RemoveVolFinalizer
func), apiserver is responding with conflict error (the object has been modified; please apply your changes to the latest version
), i.e someone has updated the lvmvol object from the moment it was queried, so apiserver can't apply updates with older resource version (optimistic locking).Another question that may arise it who is updating the lvmvol object since only openebs (csi controller and node agents) manages its lifecycle. It's the garbage collection controller removing a foregroundDeletion finalizer from the object. Here are the relevant kube apiserver side audit logs
In nutshell, we need to check if the lv exists before trying to delete it thus making controller idempotent. If looks good, let me know if I can create a pull request to fix this.
Environment:
kubectl version
): v1.20.1/etc/os-release
): Debian 9The text was updated successfully, but these errors were encountered: