nodefeaturerule

package
v0.19.5 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteGroupRule

func ExecuteGroupRule(r *nfdv1alpha1.GroupRule, features *nfdv1alpha1.Features) (bool, error)

ExecuteGroupRule executes the GroupRule against a set of input features, and return true if the rule matches.

func MatchInstances

func MatchInstances(m *nfdv1alpha1.MatchExpressionSet, instances []nfdv1alpha1.InstanceFeature) (bool, error)

MatchInstances evaluates the MatchExpressionSet against a set of instance features, each of which is an individual set of key-value pairs (attributes).

func MatchKeys

func MatchKeys(m *nfdv1alpha1.MatchExpressionSet, keys map[string]nfdv1alpha1.Nil) (bool, error)

MatchKeys evaluates the MatchExpressionSet against a set of keys.

func MatchValues

func MatchValues(m *nfdv1alpha1.MatchExpressionSet, values map[string]string) (bool, error)

MatchValues evaluates the MatchExpressionSet against a set of key-value pairs.

Types

type MatchedElement

type MatchedElement map[string]string

MatchedElement holds one matched Instance.

func MatchGetInstances

func MatchGetInstances(m *nfdv1alpha1.MatchExpressionSet, instances []nfdv1alpha1.InstanceFeature) (bool, []MatchedElement, error)

MatchGetInstances evaluates the MatchExpressionSet against a set of instance features, each of which is an individual set of key-value pairs (attributes). Returns a boolean that reports whether the expression matched. Also, returns a slice containing all matching instances. An empty (non-nil) slice is returned if no matching instances were found.

func MatchGetKeys

MatchGetKeys evaluates the MatchExpressionSet against a set of keys and returns all matched keys or nil if no match was found. Note that an empty MatchExpressionSet returns a match with an empty slice of matched features.

func MatchGetValues

func MatchGetValues(m *nfdv1alpha1.MatchExpressionSet, values map[string]string) (bool, []MatchedElement, error)

MatchGetValues evaluates the MatchExpressionSet against a set of key-value pairs and returns all matched key-value pairs. Note that an empty MatchExpressionSet returns a match with an empty slice of matched features.

func MatchInstanceAttributeNames

func MatchInstanceAttributeNames(m *nfdv1alpha1.MatchExpression, instances []nfdv1alpha1.InstanceFeature) (bool, []MatchedElement, error)

MatchInstanceAttributeNames evaluates the MatchExpression against a set of instance features, matching against the names of their attributes.

func MatchKeyNames

func MatchKeyNames(m *nfdv1alpha1.MatchExpression, keys map[string]nfdv1alpha1.Nil) (bool, []MatchedElement, error)

MatchKeyNames evaluates the MatchExpression against names of a set of key features.

func MatchMulti

func MatchMulti(m *nfdv1alpha1.MatchExpressionSet, keys map[string]nfdv1alpha1.Nil, values map[string]string, instances []nfdv1alpha1.InstanceFeature) (bool, []MatchedElement, error)

MatchMulti evaluates a MatchExpressionSet against key, value and instance features all at once. Key and values features are evaluated together so that a match in either (or both) of them is accepted as success. Instances are handled separately as the way of evaluating match expressions is different. This function is written to handle "multi-type" features where one feature (say "cpu.cpuid") contains multiple types (flag, attribute and/or instance).

func MatchNamesMulti

func MatchNamesMulti(m *nfdv1alpha1.MatchExpression, keys map[string]nfdv1alpha1.Nil, values map[string]string, instances []nfdv1alpha1.InstanceFeature) (bool, []MatchedElement, error)

MatchNamesMulti evaluates the MatchExpression against the names of key, value and attributes of instance features all at once. It is meant to handle "multi-type" features where one feature (say "cpu.cpuid") contains multiple types (flag, attribute and/or instance).

func MatchValueNames

func MatchValueNames(m *nfdv1alpha1.MatchExpression, values map[string]string) (bool, []MatchedElement, error)

MatchValueNames evaluates the MatchExpression against names of a set of value features.

type RuleOutput

type RuleOutput struct {
	ExtendedResources map[string]string
	Labels            map[string]string
	Annotations       map[string]string
	Vars              map[string]string
	Taints            []corev1.Taint
}

RuleOutput contains the output out rule execution. +k8s:deepcopy-gen=false

func Execute

func Execute(r *nfdv1alpha1.Rule, features *nfdv1alpha1.Features) (RuleOutput, error)

Execute the rule against a set of input features.

Jump to

Keyboard shortcuts

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