patching

package
v0.0.0-...-a719f44 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: UPL-1.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PatchIgnore - If the patching json is this we can skip the patching.
	PatchIgnore = "{\"metadata\":{\"creationTimestamp\":null},\"status\":{\"replicas\":0}}"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourcePatcher

type ResourcePatcher interface {
	// TwoWayPatch performs a two-way merge patching on the resource.
	TwoWayPatch(context.Context, string, client.Object, client.Object) (bool, error)
	// CreateTwoWayPatch creates a two-way patching between the original state, the current state and the desired state of a k8s resource.
	CreateTwoWayPatch(string, runtime.Object, runtime.Object, ...string) (client.Patch, error)
	// CreateTwoWayPatchOfType creates a two-way patching between the current state and the desired state of a k8s resource.
	CreateTwoWayPatchOfType(types.PatchType, string, runtime.Object, runtime.Object, ...string) (client.Patch, error)
	// ThreeWayPatch performs a three-way merge patching on the resource returning true if a patching was required otherwise false.
	ThreeWayPatch(context.Context, string, client.Object, client.Object, client.Object) (bool, error)
	// ThreeWayPatchWithCallback performs a three-way merge patching on the resource returning true if a patching was required otherwise false.
	ThreeWayPatchWithCallback(context.Context, string, client.Object, client.Object, client.Object, func()) (bool, error)
	// ApplyThreeWayPatchWithCallback performs a three-way merge patching on the resource returning true if a patching was required otherwise false.
	ApplyThreeWayPatchWithCallback(context.Context, string, client.Object, client.Patch, []byte, func()) (bool, error)
	// CreateThreeWayPatch creates a three-way patching between the original state, the current state and the desired state of a k8s resource.
	CreateThreeWayPatch(string, runtime.Object, runtime.Object, runtime.Object, ...string) (client.Patch, []byte, error)
	// CreateThreeWayPatchData creates a three-way patching between the original state, the current state and the desired state of a k8s resource.
	CreateThreeWayPatchData(original, desired, current runtime.Object) ([]byte, error)
	// GetPatchType returns the patching type this patcher uses
	GetPatchType() types.PatchType
	// SetPatchType sets the patching type this patcher uses
	SetPatchType(pt types.PatchType)
}

func NewResourcePatcher

func NewResourcePatcher(mgr manager.Manager, logger logr.Logger, patchType types.PatchType) ResourcePatcher

NewResourcePatcher creates a new ResourcePatcher

Jump to

Keyboard shortcuts

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