func (nsp *NetworkSecurityProbe) Stop() error {
	// 1) Stop kube informer
	if err := nsp.KubeInformer.Stop(); err != nil {
		nspLogger.Errorf("couldn't stop k8s informer: %s (Ctrl+C to abort)", err)
	}
	// 2) Stop monitors
	for _, p := range nsp.Monitors {
		if err := p.Stop(); err != nil {
			nspLogger.Errorf("couldn't stop monitor \"%s\" (Ctrl+C to abort): %v", p.GetName(), err)
		}
	}
	for _, p := range nsp.TCMonitors {
		if err := p.Stop(); err != nil {
			nspLogger.Errorf("couldn't stop monitor \"%s\" (Ctrl+C to abort): %v", p.GetName(), err)
		}
	}
	// 3) Stop processors
	for _, p := range processor.ProcessorsList {
		if err := p.Stop(); err != nil {
			nspLogger.Errorf("couldn't stop processor \"%s\" (Ctrl+C to abort): %v", p.GetName(), err)
		}
	}
	// 4) Stop module
	if errs := nsp.Collection.Close(); len(errs) > 0 {
		nspLogger.Errorf("couldn't close collection gracefully: %v", errs)
	}
	// Wait for all goroutine to stop
	nsp.wg.Wait()
	nspLogger.Debugln("network security probe done.")
	return nil
}
// Stop - Stops the network security probe and does all the required cleanups
Stops the network security probe and does all the required cleanups
// Stop - Stops the network security probe and does all the required cleanups
func (nsp *NetworkSecurityProbe) Stop() error {
	if err := nsp.KubeInformer.Stop(); err != nil {
		nspLogger.Errorf("couldn't stop k8s informer: %s (Ctrl+C to abort)", err)
	}
	for _, p := range nsp.Monitors {
		if err := p.Stop(); err != nil {
			nspLogger.Errorf("couldn't stop monitor \"%s\" (Ctrl+C to abort): %v", p.GetName(), err)
		}
	}
	for _, p := range nsp.TCMonitors {
		if err := p.Stop(); err != nil {
			nspLogger.Errorf("couldn't stop monitor \"%s\" (Ctrl+C to abort): %v", p.GetName(), err)
		}
	}
	for _, p := range processor.ProcessorsList {
		if err := p.Stop(); err != nil {
			nspLogger.Errorf("couldn't stop processor \"%s\" (Ctrl+C to abort): %v", p.GetName(), err)
		}
	}
	if errs := nsp.Collection.Close(); len(errs) > 0 {
		nspLogger.Errorf("couldn't close collection gracefully: %v", errs)
	}
	nsp.wg.Wait()
	nspLogger.Debugln("network security probe done.")
	return nil
}
func ( nsp * NetworkSecurityProbe ) Stop ( ) error { if err := nsp . KubeInformer . Stop ( ) ; err != nil { nspLogger . Errorf ( " " , err ) } for _ , p := range nsp . Monitors { if err := p . Stop ( ) ; err != nil { nspLogger . Errorf ( " \" \" " , p . GetName ( ) , err ) } } for _ , p := range nsp . TCMonitors { if err := p . Stop ( ) ; err != nil { nspLogger . Errorf ( " \" \" " , p . GetName ( ) , err ) } } for _ , p := range processor . ProcessorsList { if err := p . Stop ( ) ; err != nil { nspLogger . Errorf ( " \" \" " , p . GetName ( ) , err ) } } if errs := nsp . Collection . Close ( ) ; len ( errs ) > 0 { nspLogger . Errorf ( " " , errs ) } nsp . wg . Wait ( ) nspLogger . Debugln ( " " ) return nil }
Stops the network security probe and does all the required cleanups
Stops the network security probe and does all the required cleanups
// 1) Stop kube informer // 2) Stop monitors // 3) Stop processors // 4) Stop module // Wait for all goroutine to stop