Documentation ¶
Index ¶
- Constants
- func ExecuteGroupRule(r *nfdv1alpha1.GroupRule, features *nfdv1alpha1.Features, failFast bool) (bool, error)
- func MatchInstances(m *nfdv1alpha1.MatchExpressionSet, instances []nfdv1alpha1.InstanceFeature, ...) (bool, error)
- func MatchKeys(m *nfdv1alpha1.MatchExpressionSet, keys map[string]nfdv1alpha1.Nil) (bool, error)
- func MatchValues(m *nfdv1alpha1.MatchExpressionSet, values map[string]string, failFast bool) (bool, *nfdv1alpha1.MatchExpressionSet, error)
- type MatchFeatureStatus
- type MatchStatus
- type MatchedElement
- func MatchGetInstances(m *nfdv1alpha1.MatchExpressionSet, instances []nfdv1alpha1.InstanceFeature, ...) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, error)
- func MatchGetKeys(m *nfdv1alpha1.MatchExpressionSet, keys map[string]nfdv1alpha1.Nil) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, error)
- func MatchGetValues(m *nfdv1alpha1.MatchExpressionSet, values map[string]string, failFast bool) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, error)
- func MatchInstanceAttributeNames(m *nfdv1alpha1.MatchExpression, instances []nfdv1alpha1.InstanceFeature) (bool, []MatchedElement, error)
- func MatchKeyNames(m *nfdv1alpha1.MatchExpression, keys map[string]nfdv1alpha1.Nil) (bool, []MatchedElement, error)
- func MatchMulti(m *nfdv1alpha1.MatchExpressionSet, keys map[string]nfdv1alpha1.Nil, ...) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, error)
- func MatchNamesMulti(m *nfdv1alpha1.MatchExpression, keys map[string]nfdv1alpha1.Nil, ...) (bool, []MatchedElement, error)
- func MatchValueNames(m *nfdv1alpha1.MatchExpression, values map[string]string) (bool, []MatchedElement, error)
- type RuleOutput
Constants ¶
const ( // MatchedKeyName is the name of the matched flag/attribute element. MatchedKeyName = "Name" // MatchedKeyValue is the value of the matched attribute element. MatchedKeyValue = "Value" )
Variables ¶
This section is empty.
Functions ¶
func ExecuteGroupRule ¶
func ExecuteGroupRule(r *nfdv1alpha1.GroupRule, features *nfdv1alpha1.Features, failFast bool) (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, failFast bool) (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, failFast bool) (bool, *nfdv1alpha1.MatchExpressionSet, error)
MatchValues evaluates the MatchExpressionSet against a set of key-value pairs.
Types ¶
type MatchFeatureStatus ¶ added in v0.17.0
type MatchFeatureStatus struct { // MatchedFeatures represents the features matched on the host, // which is a result of the FeatureMatcher. MatchedFeatures matchedFeatures // MatchedFeaturesTerms represents the expressions that successfully matched on the host. MatchedFeaturesTerms nfdv1alpha1.FeatureMatcher }
MatchFeatureStatus represents a matched expression with its result, which is matched host features. +k8s:deepcopy-gen=false
type MatchStatus ¶ added in v0.17.0
type MatchStatus struct { *MatchFeatureStatus // IsMatch informes whether a rule succeeded or failed. IsMatch bool // MatchAny represents an array of logical OR conditions between MatchFeatureStatus entries. MatchAny []*MatchFeatureStatus }
MatchStatus represents the status of a processed rule. It includes information about successful expressions and their results, which are the matched host features. For example, for the expression: cpu.cpuid: {op: "InRegexp", value: ["^AVX"]}, the result could include matched host features such as AVX, AVX2, AVX512 etc. +k8s:deepcopy-gen=false
type MatchedElement ¶
MatchedElement holds one matched Instance.
func MatchGetInstances ¶
func MatchGetInstances(m *nfdv1alpha1.MatchExpressionSet, instances []nfdv1alpha1.InstanceFeature, failFast bool) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, 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 ¶
func MatchGetKeys(m *nfdv1alpha1.MatchExpressionSet, keys map[string]nfdv1alpha1.Nil) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, error)
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, failFast bool) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, 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, failFast bool) (bool, []MatchedElement, *nfdv1alpha1.MatchExpressionSet, 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 MatchStatus *MatchStatus }
RuleOutput contains the output out rule execution. +k8s:deepcopy-gen=false
func Execute ¶
func Execute(r *nfdv1alpha1.Rule, features *nfdv1alpha1.Features, failFast bool) (RuleOutput, error)
Execute the rule against a set of input features.