Documentation
¶
Overview ¶
Package patch contains patch utils.
Index ¶
- func ApplyPatchToObject(ctx context.Context, obj *runtime.RawExtension, patch runtimehooksv1.Patch, ...) (objChanged bool, reterr error)
- func ApplyPatchToTypedObject[T any](ctx context.Context, currentMachine *T, machinePath runtimehooksv1.Patch, ...) error
- func ConvertToRawExtension(object any) (runtime.RawExtension, error)
- func CopySpec(in CopySpecInput) error
- func Patch(object *runtime.RawExtension, patchedObjectBytes []byte, patchPath string) error
- type CopySpecInput
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.
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.
Click to show internal directories.
Click to hide internal directories.