-
Notifications
You must be signed in to change notification settings - Fork 113
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(controller): add finalizer to claimed BD #416
Conversation
add openebs.io/bd-protection finalizer to BDs that are in claimed state to prevent accidental deletion Signed-off-by: Akhil Mohan <akhil.mohan@mayadata.io>
Codecov Report
@@ Coverage Diff @@
## master #416 +/- ##
==========================================
+ Coverage 44.24% 44.78% +0.54%
==========================================
Files 59 59
Lines 2839 2869 +30
==========================================
+ Hits 1256 1285 +29
- Misses 1479 1482 +3
+ Partials 104 102 -2
Continue to review full report at Codecov.
|
err := r.updateBDStatus(openebsv1alpha1.BlockDeviceUnclaimed, instance) | ||
if err != nil { | ||
reqLogger.Error(err, "marking blockdevice "+instance.Name+" as Unclaimed failed") | ||
} | ||
} | ||
case openebsv1alpha1.BlockDeviceClaimed: | ||
if !util.Contains(instance.GetFinalizers(), controllerutil.BlockDeviceFinalizer) { | ||
// finalizer is not present, may be a BlockDevice claimed from previous release |
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.
👍
Signed-off-by: Akhil Mohan akhil.mohan@mayadata.io
Pull Request template
Why is this PR required? What issue does it fix?:
When a user deletes a BD that is claimed, the BD will be automatically recreated by NDM daemon pod. But the recreated BD will be in Unclaimed state. Thus another claim can get bound to the same BD resulting in data corruption.
What this PR does?:
openebs.io/bd-protection
finalizer to BDs that are inClaimed
stateDoes 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>