patch

package
v1.12.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package patch contains patch utils.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPatchToObject

func ApplyPatchToObject(ctx context.Context, obj *runtime.RawExtension, patch runtimehooksv1.Patch, patchPath string) (objChanged bool, reterr error)

ApplyPatchToObject applies the patch to the obj. Note: This is following the same general structure that is used in the applyPatchToRequest func in internal/controllers/topology/cluster/patches/engine.go.

func ApplyPatchToTypedObject

func ApplyPatchToTypedObject[T any](ctx context.Context, currentMachine *T, machinePath runtimehooksv1.Patch, patchPath string) error

ApplyPatchToTypedObject applies the patch to a typed obj.

func ConvertToRawExtension

func ConvertToRawExtension(object any) (runtime.RawExtension, error)

ConvertToRawExtension converts any object to a runtime.RawExtension.

func CopySpec

func CopySpec(in CopySpecInput) error

CopySpec copies a field from a srcSpecPath in src to a destSpecPath in dest, while preserving fieldsToPreserve.

func Patch

func Patch(object *runtime.RawExtension, patchedObjectBytes []byte, patchPath string) error

Patch overwrites spec in object with spec of patchedObjectBytes.

Types

type CopySpecInput

type CopySpecInput struct {
	Src              *unstructured.Unstructured
	Dest             *unstructured.Unstructured
	SrcSpecPath      string
	DestSpecPath     string
	FieldsToPreserve []contract.Path
}

CopySpecInput is a struct containing the input parameters of CopySpec.

Jump to

Keyboard shortcuts

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