Documentation
¶
Index ¶
- Constants
- type CompiledExpression
- func (c *CompiledExpression) EvaluateBoolean(ctx context.Context, object unstructured.Unstructured) (bool, error)
- func (c *CompiledExpression) EvaluateBooleanWithVariables(ctx context.Context, variables map[string]any) (bool, error)
- func (c *CompiledExpression) EvaluateCondition(ctx context.Context, object, request map[string]any) (bool, error)
- func (c *CompiledExpression) EvaluateConditionWithVolume(ctx context.Context, object, request, volume map[string]any) (bool, error)
- func (c *CompiledExpression) EvaluateQuantity(ctx context.Context, object unstructured.Unstructured) (resource.Quantity, error)
- func (c *CompiledExpression) EvaluateStringWithVariables(ctx context.Context, variables map[string]any) (string, error)
- func (c *CompiledExpression) Expression() string
- type Compiler
- func (c *Compiler) CompileBoolean(expression string, mode environment.Type) (*CompiledExpression, error)
- func (c *Compiler) CompileBooleanWithVariables(expression string, mode environment.Type, variables ...string) (*CompiledExpression, error)
- func (c *Compiler) CompileCondition(expression string, mode environment.Type) (*CompiledExpression, error)
- func (c *Compiler) CompileQuantity(expression string, mode environment.Type) (*CompiledExpression, error)
- func (c *Compiler) CompileResourceCondition(expression string, mode environment.Type) (*CompiledExpression, error)
- func (c *Compiler) CompileStringWithVariables(expression string, mode environment.Type, variables ...string) (*CompiledExpression, error)
- type ResourceConditionCompiler
- type ResultType
Constants ¶
const ( ObjectVariable = "object" MaxExpressionLength = 4096 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompiledExpression ¶
type CompiledExpression struct {
// contains filtered or unexported fields
}
func (*CompiledExpression) EvaluateBoolean ¶
func (c *CompiledExpression) EvaluateBoolean( ctx context.Context, object unstructured.Unstructured, ) (bool, error)
func (*CompiledExpression) EvaluateBooleanWithVariables ¶ added in v0.15.0
func (c *CompiledExpression) EvaluateBooleanWithVariables( ctx context.Context, variables map[string]any, ) (bool, error)
EvaluateBooleanWithVariables evaluates a compiled boolean expression using the supplied CEL activation.
func (*CompiledExpression) EvaluateCondition ¶ added in v0.15.0
func (*CompiledExpression) EvaluateConditionWithVolume ¶ added in v0.15.0
func (c *CompiledExpression) EvaluateConditionWithVolume(ctx context.Context, object, request, volume map[string]any) (bool, error)
EvaluateConditionWithVolume supplies a read-only PV snapshot for PVC volume enforcement. Other condition consumers see volume as null.
func (*CompiledExpression) EvaluateQuantity ¶
func (c *CompiledExpression) EvaluateQuantity( ctx context.Context, object unstructured.Unstructured, ) (resource.Quantity, error)
func (*CompiledExpression) EvaluateStringWithVariables ¶ added in v0.15.0
func (c *CompiledExpression) EvaluateStringWithVariables( ctx context.Context, variables map[string]any, ) (string, error)
EvaluateStringWithVariables evaluates a compiled string expression using the supplied CEL activation.
func (*CompiledExpression) Expression ¶
func (c *CompiledExpression) Expression() string
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
func NewCompiler ¶
func (*Compiler) CompileBoolean ¶
func (c *Compiler) CompileBoolean(expression string, mode environment.Type) (*CompiledExpression, error)
func (*Compiler) CompileBooleanWithVariables ¶ added in v0.15.0
func (c *Compiler) CompileBooleanWithVariables( expression string, mode environment.Type, variables ...string, ) (*CompiledExpression, error)
CompileBooleanWithVariables compiles a boolean expression with additional dynamically typed variables. The standard object variable remains available.
func (*Compiler) CompileCondition ¶ added in v0.15.0
func (c *Compiler) CompileCondition(expression string, mode environment.Type) (*CompiledExpression, error)
func (*Compiler) CompileQuantity ¶
func (c *Compiler) CompileQuantity(expression string, mode environment.Type) (*CompiledExpression, error)
func (*Compiler) CompileResourceCondition ¶ added in v0.15.0
func (c *Compiler) CompileResourceCondition(expression string, mode environment.Type) (*CompiledExpression, error)
func (*Compiler) CompileStringWithVariables ¶ added in v0.15.0
func (c *Compiler) CompileStringWithVariables( expression string, mode environment.Type, variables ...string, ) (*CompiledExpression, error)
CompileStringWithVariables compiles a string expression with additional dynamically typed variables. This is primarily useful for Kubernetes-style CEL message expressions.
type ResourceConditionCompiler ¶ added in v0.15.0
type ResourceConditionCompiler interface {
GetOrCompileResourceCondition(expression string, mode environment.Type) (*CompiledExpression, error)
}
ResourceConditionCompiler shares immutable compiled apply conditions between admission and controllers. Evaluation inputs and results are never cached.
type ResultType ¶
type ResultType string
const ( ResultTypeBoolean ResultType = "boolean" ResultTypeQuantity ResultType = "quantity" ResultTypeCondition ResultType = "condition" ResultTypeString ResultType = "string" )