patcher

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyObject

func ApplyObject(ctx *synccontext.SyncContext, beforeObject, afterObject client.Object, direction synccontext.SyncDirection, hasStatus bool) error

func ApplyObjectPatch

func ApplyObjectPatch(ctx *synccontext.SyncContext, objPatch patch.Patch, obj client.Object, direction synccontext.SyncDirection, hasStatus bool) error

func CopyBidirectional

func CopyBidirectional[T any](virtualOld, virtual, hostOld, host T) (T, T)

func CreateHostObject

func CreateHostObject(ctx *synccontext.SyncContext, vObj, pObj client.Object, eventRecorder record.EventRecorder, hasStatus bool) (ctrl.Result, error)

func CreateVirtualObject

func CreateVirtualObject(ctx *synccontext.SyncContext, pObj, vObj client.Object, eventRecorder record.EventRecorder, hasStatus bool) (ctrl.Result, error)

func DeleteHostObject

func DeleteHostObject(ctx *synccontext.SyncContext, pObj, vObjOld client.Object, reason string) (ctrl.Result, error)

func DeleteHostObjectWithOptions

func DeleteHostObjectWithOptions(ctx *synccontext.SyncContext, pObj, vObjOld client.Object, reason string, options *client.DeleteOptions) (ctrl.Result, error)

func DeleteVirtualObject

func DeleteVirtualObject(ctx *synccontext.SyncContext, vObj, pObjOld client.Object, reason string) (ctrl.Result, error)

func DeleteVirtualObjectWithOptions

func DeleteVirtualObjectWithOptions(ctx *synccontext.SyncContext, vObj, pObjOld client.Object, reason string, options *client.DeleteOptions) (ctrl.Result, error)

func MergeBidirectional

func MergeBidirectional[T any](virtualOld, virtual, hostOld, host T) (T, T, error)

func MergeChangesInto

func MergeChangesInto[T any](oldValue, newValue, outValue T) (T, error)

Types

type Option

type Option interface {
	Apply(p *Patcher)
}

func NoStatusSubResource

func NoStatusSubResource() Option

func TranslatePatches

func TranslatePatches(translate []config.TranslatePatch, reverseExpressions bool) Option

type Patcher

type Patcher struct {
	NoStatusSubResource bool
	// contains filtered or unexported fields
}

Patcher is a utility for ensuring the proper patching of objects.

func NewPatcher

func NewPatcher(obj client.Object, crClient client.Client, options ...Option) (*Patcher, error)

NewPatcher returns an initialized Patcher.

func (*Patcher) Patch

func (h *Patcher) Patch(ctx *synccontext.SyncContext, obj client.Object) error

Patch will attempt to patch the given object, including its status.

type SyncerPatcher

type SyncerPatcher struct {
	// contains filtered or unexported fields
}

func NewSyncerPatcher

func NewSyncerPatcher(ctx *synccontext.SyncContext, pObj, vObj client.Object, options ...Option) (*SyncerPatcher, error)

func (*SyncerPatcher) Patch

func (h *SyncerPatcher) Patch(ctx *synccontext.SyncContext, pObj, vObj client.Object) error

Patch will attempt to patch the given object, including its status.

Jump to

Keyboard shortcuts

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