classifier

package
v0.4.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module fx.Option = fx.Options(
	fx.Provide(
		fx.Annotated{
			Target: setupEtcdClassifierWatcher,
			Name:   "classifier",
		},
		ProvideClassificationEngine,
	),
)

Module is a default set of components to enable flow classification

Note: this module provides just a Classifier datastructure, with no API endpoint. Example API endpoint to the classifier is pkg/envoy.

Functions

This section is empty.

Types

type ActiveRuleset

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

ActiveRuleset represents one of currently active set of rules.

func (ActiveRuleset) Drop

func (rs ActiveRuleset) Drop()

Drop retracts all the rules belonging to a ruleset.

type ClassificationEngine added in v0.2.1

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

ClassificationEngine receives classification policies and provides Classify method.

func NewClassificationEngine added in v0.3.0

func NewClassificationEngine(registry status.Registry) *ClassificationEngine

NewClassificationEngine creates a new Flow Classifier.

func ProvideClassificationEngine added in v0.2.1

func ProvideClassificationEngine(in ClassificationEngineIn) *ClassificationEngine

ProvideClassificationEngine provides a classifier that loads the rules from config file.

func (*ClassificationEngine) ActiveRules added in v0.2.1

func (c *ClassificationEngine) ActiveRules() []compiler.ReportedRule

ActiveRules returns a slice of uncompiled Rules which are currently active.

func (*ClassificationEngine) AddRules added in v0.2.1

func (c *ClassificationEngine) AddRules(
	ctx context.Context,
	name string,
	classifierWrapper *wrappersv1.ClassifierWrapper,
) (ActiveRuleset, error)

AddRules compiles a ruleset and adds it to the active rules

The name will be used for reporting

To retract the rules, call Classifier.Drop.

func (*ClassificationEngine) Classify added in v0.2.1

func (c *ClassificationEngine) Classify(
	ctx context.Context,
	svcs []string,
	ctrlPt selectors.ControlPoint,
	labelsForMatching map[string]string,
	input ast.Value,
) ([]*flowcontrolv1.ClassifierInfo, flowlabel.FlowLabels, error)

Classify takes rego input, performs classification, and returns a map of flow labels. LabelsForMatching are additional labels to use for selector matching.

func (*ClassificationEngine) GetSelector added in v0.2.1

func (c *ClassificationEngine) GetSelector() *selectorv1.Selector

GetSelector returns the selector.

type ClassificationEngineIn added in v0.2.1

type ClassificationEngineIn struct {
	fx.In
	Watcher   notifiers.Watcher `name:"classifier"`
	Lifecycle fx.Lifecycle
	Registry  status.Registry
}

ClassificationEngineIn holds parameters for ProvideClassificationEngine.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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