patch

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyStructuredMergeDiff

func ApplyStructuredMergeDiff(
	typeConverter managedfields.TypeConverter,
	originalObject runtime.Object,
	patch *unstructured.Unstructured,
) (runtime.Object, error)

ApplyStructuredMergeDiff applies a structured merge diff to an object and returns a copy of the object with the patch applied.

Types

type ApplyConfigurationCondition

type ApplyConfigurationCondition struct {
	Expression string
}

ApplyConfigurationCondition contains the inputs needed to compile and evaluate a cel expression that returns an apply configuration

func (*ApplyConfigurationCondition) GetExpression

func (v *ApplyConfigurationCondition) GetExpression() string

func (*ApplyConfigurationCondition) ReturnTypes

func (v *ApplyConfigurationCondition) ReturnTypes() []*celgo.Type

type JSONPatchCondition

type JSONPatchCondition struct {
	Expression string
}

JSONPatchCondition contains the inputs needed to compile and evaluate a cel expression that returns a JSON patch value.

func (*JSONPatchCondition) GetExpression

func (v *JSONPatchCondition) GetExpression() string

func (*JSONPatchCondition) ReturnTypes

func (v *JSONPatchCondition) ReturnTypes() []*celgo.Type

type Patcher

type Patcher interface {
	// Patch returns a copy of the object in the request, modified to change specified by the patch.
	// The original object in the request MUST NOT be modified in-place.
	Patch(ctx context.Context, request Request, runtimeCELCostBudget int64) (runtime.Object, error)
}

Patcher provides a patch function to perform a mutation to an object in the admission chain.

func NewApplyConfigurationPatcher

func NewApplyConfigurationPatcher(expressionEvaluator plugincel.MutatingEvaluator) Patcher

NewApplyConfigurationPatcher creates a patcher that performs an applyConfiguration mutation.

func NewJSONPatcher

func NewJSONPatcher(patchEvaluator plugincel.MutatingEvaluator) Patcher

NewJSONPatcher creates a patcher that performs a JSON Patch mutation.

type Request

type Request struct {
	MatchedResource     schema.GroupVersionResource
	VersionedAttributes *admission.VersionedAttributes
	ObjectInterfaces    admission.ObjectInterfaces
	OptionalVariables   cel.OptionalVariableBindings
	Namespace           *v1.Namespace
	TypeConverter       managedfields.TypeConverter
}

Request defines the arguments required by a patcher.

type TypeConverterManager

type TypeConverterManager interface {
	// GetTypeConverter returns a type converter for the given GVK
	GetTypeConverter(gvk schema.GroupVersionKind) managedfields.TypeConverter
	Run(ctx context.Context)
}

func NewTypeConverterManager

func NewTypeConverterManager(
	staticTypeConverter managedfields.TypeConverter,
	openapiClient openapi.Client,
) TypeConverterManager

Jump to

Keyboard shortcuts

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