Help us shape the future of Go! Take the 2026 Go Developer Survey

cel

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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 (c *CompiledExpression) EvaluateCondition(ctx context.Context, object, request map[string]any) (bool, error)

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 NewCompiler() (*Compiler, error)

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"
)

Jump to

Keyboard shortcuts

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