apiserverk8s.io/apiserver/pkg/cel/mutation Index | Files | Directories

package mutation

import "k8s.io/apiserver/pkg/cel/mutation"

Index

Constants

const JSONPatchTypeName = "JSONPatch"

JSONPatchTypeName is the name of the JSONPatch type. This type is typically used to create JSON patches in CEL expressions.

const ObjectTypeName = "Object"

ObjectTypeName is the name of Object types that are used to declare the types of Kubernetes objects in CEL dynamically using the naming scheme "Object.<fieldName>...<fieldName>". For example "Object.spec.containers" is the type of the spec.containers field of the object in scope.

Types

type DynamicTypeResolver

type DynamicTypeResolver struct{}

DynamicTypeResolver resolves the Object and JSONPatch types when compiling CEL expressions without schema information about the object.

func (*DynamicTypeResolver) Resolve

func (r *DynamicTypeResolver) Resolve(name string) (common.ResolvedType, bool)

type JSONPatchType

type JSONPatchType struct{}

JSONPatchType provides a CEL type for "JSONPatch" operations.

func (*JSONPatchType) Field

func (r *JSONPatchType) Field(name string) (*types.FieldType, bool)

func (*JSONPatchType) FieldNames

func (r *JSONPatchType) FieldNames() ([]string, bool)

func (*JSONPatchType) HasTrait

func (r *JSONPatchType) HasTrait(trait int) bool

func (*JSONPatchType) Type

func (r *JSONPatchType) Type() *types.Type

func (*JSONPatchType) TypeName

func (r *JSONPatchType) TypeName() string

TypeName returns the name of this ObjectType.

func (*JSONPatchType) Val

func (r *JSONPatchType) Val(fields map[string]ref.Val) ref.Val

Val returns an instance given the fields.

type JSONPatchVal

type JSONPatchVal struct {
	Op, From, Path string
	Val            ref.Val
}

JSONPatchVal is the ref.Val for a JSONPatch.

func (*JSONPatchVal) ConvertToNative

func (p *JSONPatchVal) ConvertToNative(typeDesc reflect.Type) (any, error)

func (*JSONPatchVal) ConvertToType

func (p *JSONPatchVal) ConvertToType(typeValue ref.Type) ref.Val

func (*JSONPatchVal) Equal

func (p *JSONPatchVal) Equal(other ref.Val) ref.Val

func (*JSONPatchVal) Get

func (p *JSONPatchVal) Get(index ref.Val) ref.Val

func (*JSONPatchVal) IsSet

func (p *JSONPatchVal) IsSet(field ref.Val) ref.Val

func (*JSONPatchVal) Type

func (p *JSONPatchVal) Type() ref.Type

func (*JSONPatchVal) Value

func (p *JSONPatchVal) Value() any

Source Files

jsonpatch.go typeresolver.go

Directories

PathSynopsis
pkg/cel/mutation/dynamic
Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
1 hour ago

Tools for package owners.