collector

package
v1.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMapRuleCollector

type ConfigMapRuleCollector struct {
	// contains filtered or unexported fields
}

ConfigMapRuleCollector is used to collect rules from a kubernetes configmaps. Rules will be collect from the configmaps in the sensor namespace with the label provided via the sensorRuleConfigMapLabel field.

func NewConfigMapRuleCollector

func NewConfigMapRuleCollector(clientSet *kubernetes.Clientset, sensorNamespace string, sensorRuleConfigMapLabel string) *ConfigMapRuleCollector

NewConfigMapRuleCollector returns a new ConfigMapRuleCollector.

func (ConfigMapRuleCollector) Collect

func (cmrc ConfigMapRuleCollector) Collect(ctx context.Context) (map[rules.RuleID]*rules.Rule, error)

Collect will return all rules from the configmaps in the sensor namespace with the label configured via sensorRuleConfigMapLabel. Only one copy of the duplicate rules will be returned. If the configmap does not exist or the rules are invalid, an empty map will be returned. If unable to list all configmaps in the sensor namespace, an error will be returned.

func (ConfigMapRuleCollector) StartRuleCollector

func (cmrc ConfigMapRuleCollector) StartRuleCollector(ctx context.Context, sensorRI SensorReloadInterface)

StartRuleCollector will continuously listen for rule configmap changes and will reload the rules of the provided sensor. Cancelling the provided context will stop the collector.

type SensorReloadInterface

type SensorReloadInterface interface {
	ReloadRules(sensorRules map[rules.RuleID]*rules.Rule)
}

SensorReloadInterface should be implemented by sensors which needs to support automatic reloading of rules.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL