-
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
feat(probe): add size change detection #616
Conversation
Codecov Report
@@ Coverage Diff @@
## master #616 +/- ##
==========================================
+ Coverage 46.38% 46.93% +0.54%
==========================================
Files 78 78
Lines 3781 3814 +33
==========================================
+ Hits 1754 1790 +36
+ Misses 1871 1866 -5
- Partials 156 158 +2
Continue to review full report at Codecov.
|
@@ -214,3 +214,21 @@ func (disk *Disk) Unmount() error { | |||
} | |||
return lastErr | |||
} | |||
|
|||
func (disk *Disk) Resize(size int64) error { | |||
units := [4]string{"", "K", "M", "G"} |
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.
There should be something in this package to help you with this. https://pkg.go.dev/k8s.io/kubernetes@v1.22.0/pkg/api/v1/resource
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.
@RealHarshThakur I wasn't able to figure out how to use the package here. Could you please help out?
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.
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.
Plan is to switch API fields to use this type too but we need to upgrade the CRD version.
"k8s.io/klog" | ||
) | ||
|
||
func (pe *ProbeEvent) changeBlockDevice(bd *blockdevice.BlockDevice, requestedProbes ...string) error { | ||
bdCopy := *bd | ||
equalMountPoints := true |
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.
A better variable name can be chosen. This is a bit confusing.
@@ -34,7 +34,8 @@ const ( | |||
// DetachEA is detach disk event name | |||
DetachEA EventAction = libudevwrapper.UDEV_ACTION_REMOVE | |||
// MountEA is mount-point/fs change event | |||
MountEA EventAction = "mount-change" | |||
MountEA EventAction = "mount-change" |
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.
Should we need 2 separate events now?
cmd/ndm_daemonset/probe/udevprobe.go
Outdated
if features.FeatureGates.IsEnabled(features.SizeChangeDetection) || | ||
features.FeatureGates.IsEnabled(features.MountChangeDetection) { |
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.
Can we make this into one feature flag, instead of having 2 separate features?
cmd/ndm_daemonset/probe/udevprobe.go
Outdated
eventMessage.RequestedProbes = []string{udevProbeName, | ||
sysfsProbeName} | ||
} else { | ||
eventMessage.RequestedProbes = []string{udevProbeName} |
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.
This is for detecting the filesystem changes right? This also need to be done only if the feature gate is enabled.
pkg/features/features.go
Outdated
|
||
// SizeChangeDetection feature flag is used to enable size | ||
// change detection for block devices | ||
SizeChangeDetection Feature = "SizeChangeDetection" |
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.
Instead of using 2 separate feature gates, we should use just one feature gate as both of them are similar
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.
@z0marlin some questions and changes are needed.
79c1975
to
60cd0d1
Compare
MountChangeDetection = "MountChangeDetection" | ||
// ChangeDetection is used to enable detecting changes to | ||
// blockdevice size, filesystem, and mount-points. | ||
ChangeDetection Feature = "ChangeDetection" |
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.
This change also need to be made in the operator and chart files in the deploy/
directory
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.
@z0marlin have a few nitpick comments
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.
a few nitpick comments on the operator yaml
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
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
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. Thanks @z0marlin
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
process all udev events, including change events in udev probe alone instead of processing them in other probes. The udev probe alone can send out required event message after processing the change events. Since the remaining two types - add and remove are also handled by udev probe, keeping the third type (change) too in the same probe is cleaner and logical. Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
the change handling mechanism is currently used to detect changes in blockdevice size, filesystem, and mount-points. Add checks to prevent calls to the kube api server in case any of these fields haven't changed after re-filling the blockdevice details using the probes. Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
merge the two flags into a single flag - `ChangeDetection` Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Co-authored-by: Akhil Mohan <akhilerm@gmail.com> Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
b84ed5b
to
05eed8a
Compare
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Signed-off-by: Akhil Mohan <akhil.mohan@mayadata.io>
Signed-off-by: Aditya Jain <aditya.jainadityajain.jain@gmail.com>
Added fixes for #625 |
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
Add blockdevice size change detection using udev change events
Checklist:
<type>(<scope>): <subject>