Skip to content

Commit

Permalink
fix(probe): check no of devices changed before sending change event f…
Browse files Browse the repository at this point in the history
…rom mount probe
  • Loading branch information
z0marlin committed Aug 24, 2021
1 parent 8f86471 commit b84ed5b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/ndm_daemonset/probe/mountprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ func (mp *mountProbe) newMountTable() (*libmount.MountTab, error) {
libmount.WithDenyFilter(libmount.SourceFilter("overlay")),
libmount.WithDenyFilter(libmount.TargetContainsFilter("/var/lib/kubelet/pod")),
libmount.WithDenyFilter(libmount.TargetContainsFilter("/var/lib/docker")),
libmount.WithDenyFilter(libmount.TargetContainsFilter("/run/docker")))
libmount.WithDenyFilter(libmount.TargetContainsFilter("/run/docker")),
libmount.WithDenyFilter(libmount.TargetContainsFilter("/run/containerd")))
}

func (mp *mountProbe) processDiff(diff libmount.MountTabDiff) {
Expand All @@ -203,7 +204,10 @@ func (mp *mountProbe) processDiff(diff libmount.MountTabDiff) {
bd.DevPath = dev
devices = append(devices, bd)
}

if len(devices) == 0 {
return
}
klog.V(4).Infof("change detected in mounts file. No. of devices affected : %d", len(devices))
mp.destination <- controller.EventMessage{
Action: string(ChangeEA),
Devices: devices,
Expand Down

0 comments on commit b84ed5b

Please sign in to comment.