Version: v1.7.0 Latest Latest

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

Go to latest
Published: Nov 29, 2021 License: Apache-2.0 Imports: 18 Imported by: 57




View Source
const LastAppliedConfig = ""


View Source
var DefaultAnnotator = NewAnnotator(LastAppliedConfig)
View Source
var DefaultPatchMaker = NewPatchMaker(DefaultAnnotator)


func DeleteNullInJson

func DeleteNullInJson(jsonBytes []byte) ([]byte, map[string]interface{}, error)


type Annotator

type Annotator struct {
	// contains filtered or unexported fields

func NewAnnotator

func NewAnnotator(key string) *Annotator

func (*Annotator) GetModifiedConfiguration

func (a *Annotator) GetModifiedConfiguration(obj runtime.Object, annotate bool) ([]byte, error)

GetModifiedConfiguration retrieves the modified configuration of the object. If annotate is true, it embeds the result as an annotation in the modified configuration. If an object was read from the command input, it will use that version of the object. Otherwise, it will use the version from the server.

func (*Annotator) GetOriginalConfiguration

func (a *Annotator) GetOriginalConfiguration(obj runtime.Object) ([]byte, error)

GetOriginalConfiguration retrieves the original configuration of the object from the annotation, or nil if no annotation was found.

func (*Annotator) SetLastAppliedAnnotation

func (a *Annotator) SetLastAppliedAnnotation(obj runtime.Object) error

SetLastAppliedAnnotation gets the modified configuration of the object, without embedding it again, and then sets it on the object as the annotation.

func (*Annotator) SetOriginalConfiguration

func (a *Annotator) SetOriginalConfiguration(obj runtime.Object, original []byte) error

SetOriginalConfiguration sets the original configuration of the object as the annotation on the object for later use in computing a three way patch.

type CalculateOption added in v1.2.0

type CalculateOption func([]byte, []byte) ([]byte, []byte, error)

func IgnoreField added in v1.6.0

func IgnoreField(field string) CalculateOption

func IgnorePDBSelector added in v1.5.2

func IgnorePDBSelector() CalculateOption

func IgnoreStatusFields added in v1.2.0

func IgnoreStatusFields() CalculateOption

func IgnoreVolumeClaimTemplateTypeMetaAndStatus added in v1.3.0

func IgnoreVolumeClaimTemplateTypeMetaAndStatus() CalculateOption

type PatchMaker

type PatchMaker struct {
	// contains filtered or unexported fields

func NewPatchMaker

func NewPatchMaker(annotator *Annotator) *PatchMaker

func (*PatchMaker) Calculate

func (p *PatchMaker) Calculate(currentObject, modifiedObject runtime.Object, opts ...CalculateOption) (*PatchResult, error)

type PatchResult

type PatchResult struct {
	Patch    []byte
	Current  []byte
	Modified []byte
	Original []byte

func (*PatchResult) IsEmpty

func (p *PatchResult) IsEmpty() bool

func (*PatchResult) String

func (p *PatchResult) String() string

Jump to

Keyboard shortcuts

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