interpreter

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Wildcard indicates that any value can be matched.
	Wildcard = "*"
)

Variables

View Source
var AllResourceInterpreterCustomizationRules = []Rule{
	&retentionRule{},
	&replicaResourceRule{},
	&replicaRevisionRule{},
	&statusReflectionRule{},
	&statusAggregationRule{},
	&healthInterpretationRule{},
	&dependencyInterpretationRule{},
}

AllResourceInterpreterCustomizationRules all InterpreterOperations

Functions

This section is empty.

Types

type Matcher

Matcher determines if the Object matches the Rule.

func (*Matcher) Matches

func (m *Matcher) Matches() bool

Matches tells if the Operation, Object matches the Rule.

type NameValue added in v1.4.0

type NameValue struct {
	Name  string
	Value interface{}
}

NameValue name and value.

type Rule added in v1.4.0

type Rule interface {
	// Name returns the name of the rule.
	Name() string
	// Document explains detail of rule.
	Document() string
	// GetScript returns the script for the rule from customization. If not enabled, return empty
	GetScript(*configv1alpha1.ResourceInterpreterCustomization) string
	// SetScript set the script for the rule. If script is empty, disable the rule.
	SetScript(*configv1alpha1.ResourceInterpreterCustomization, string)
	// Run execute the rule with given args, and return the result.
	Run(*declarative.ConfigurableInterpreter, RuleArgs) *RuleResult
}

Rule known how to get and set script for interpretation rule, and can execute the rule with given args.

type RuleArgs added in v1.4.0

type RuleArgs struct {
	Desired  *unstructured.Unstructured
	Observed *unstructured.Unstructured
	Status   []workv1alpha2.AggregatedStatusItem
	Replica  int64
}

RuleArgs rule execution args.

type RuleResult added in v1.4.0

type RuleResult struct {
	Results []NameValue
	Err     error
}

RuleResult rule execution result.

type Rules added in v1.4.0

type Rules []Rule

Rules is a series of rules.

func (Rules) Get added in v1.4.0

func (r Rules) Get(name string) Rule

Get returns the rule with the name. If not found, return nil.

func (Rules) GetByOperation added in v1.4.0

func (r Rules) GetByOperation(operation string) Rule

GetByOperation returns the matched rule by operation name, ignoring case. Return nil if none is matched.

func (Rules) Names added in v1.4.0

func (r Rules) Names() []string

Names returns the names of containing rules.

Jump to

Keyboard shortcuts

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