Documentation
¶
Index ¶
- func ApplyObject(ctx *synccontext.SyncContext, beforeObject, afterObject client.Object, ...) error
- func ApplyObjectPatch(ctx *synccontext.SyncContext, objPatch patch.Patch, obj client.Object, ...) error
- func CopyBidirectional[T any](virtualOld, virtual, hostOld, host T) (T, T)
- func CreateHostObject(ctx *synccontext.SyncContext, vObj, pObj client.Object, ...) (ctrl.Result, error)
- func CreateVirtualObject(ctx *synccontext.SyncContext, pObj, vObj client.Object, ...) (ctrl.Result, error)
- func DeleteHostObject(ctx *synccontext.SyncContext, pObj, vObjOld client.Object, reason string) (ctrl.Result, error)
- func DeleteHostObjectWithOptions(ctx *synccontext.SyncContext, pObj, vObjOld client.Object, reason string, ...) (ctrl.Result, error)
- func DeleteVirtualObject(ctx *synccontext.SyncContext, vObj, pObjOld client.Object, reason string) (ctrl.Result, error)
- func DeleteVirtualObjectWithOptions(ctx *synccontext.SyncContext, vObj, pObjOld client.Object, reason string, ...) (ctrl.Result, error)
- func MergeBidirectional[T any](virtualOld, virtual, hostOld, host T) (T, T, error)
- func MergeChangesInto[T any](oldValue, newValue, outValue T) (T, error)
- type Option
- type Patcher
- type SyncerPatcher
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)
CopyBidirectional determines whether the change is in the virtual or host object by seeing what changed between "old" and "new" for each. It then mutates the changed object to match the unchanged object.
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 ¶
MergeBidirectional determines whether the change is in the virtual or host object by seeing what changed between "old" and "new" for each. It then merges the changes from the changed object into the unchanged object by marshalling them and using a json merge patch on the unchanged object.
func MergeChangesInto ¶
MergeChangesInto merges changes from "newValue" into "outValue" based on the changes between "oldValue" and "newValue".
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 ¶
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.