mergepatch

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: Apache-2.0 Imports: 14 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

func DeepCopyWithManagedFieldAnnotation

func DeepCopyWithManagedFieldAnnotation(obj client.Object) (client.Object, error)

DeepCopyWithManagedFieldAnnotation returns a copy of the object with an annotation Keeping track of the fields the object is setting.

Types

type AuthoritativePaths

type AuthoritativePaths []contract.Path

AuthoritativePaths instruct the Helper to enforce changes for paths when computing a patch (instead of using two way merge that preserves values from existing objects). NOTE: AuthoritativePaths will be superseded by IgnorePaths in case a path exists in both.

func (AuthoritativePaths) ApplyToHelper

func (i AuthoritativePaths) ApplyToHelper(opts *HelperOptions)

ApplyToHelper applies this configuration to the given helper options.

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: patch helper consider changes only in metadata.labels, metadata.annotation and spec. 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 managed by the topology controller 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) HasSpecChanges

func (h *Helper) HasSpecChanges() bool

HasSpecChanges return true if the patch has changes to the spec field.

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