mergepatch

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mergepatch implements merge patch support for managed topology.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Helper

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

Helper helps with a patch that yields the modified document when applied to the original document.

func NewHelper

func NewHelper(original, modified client.Object, c client.Client, opts ...HelperOption) (*Helper, error)

NewHelper will return a patch that yields the modified document when applied to the original document. NOTE: In the case of ClusterTopologyReconciler, original is the current object, modified is the desired object, and the patch returns all the changes required to align current to what is defined in desired; fields not defined in desired are going to be preserved without changes.

func (*Helper) HasChanges

func (h *Helper) HasChanges() bool

HasChanges return true if the patch has changes.

func (*Helper) Patch

func (h *Helper) Patch(ctx context.Context) error

Patch will attempt to apply the twoWaysPatch to the original object.

type HelperOption

type HelperOption interface {
	// ApplyToHelper applies this configuration to the given helper options.
	ApplyToHelper(*HelperOptions)
}

HelperOption is some configuration that modifies options for Helper.

type HelperOptions

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

HelperOptions contains options for Helper.

func (*HelperOptions) ApplyOptions

func (o *HelperOptions) ApplyOptions(opts []HelperOption) *HelperOptions

ApplyOptions applies the given patch options on these options, and then returns itself (for convenient chaining).

type IgnorePaths

type IgnorePaths []contract.Path

IgnorePaths instruct the Helper to ignore given paths when computing a patch.

func (IgnorePaths) ApplyToHelper

func (i IgnorePaths) ApplyToHelper(opts *HelperOptions)

ApplyToHelper applies this configuration to the given helper options.

Jump to

Keyboard shortcuts

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