Documentation ¶
Index ¶
- func CreateTwoWayMergePatch(orig, new, dataStruct interface{}) ([]byte, bool, error)
- func GetLastAppliedConfigAnnotation(live *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func Normalize(un *unstructured.Unstructured, opts ...Option)
- func NormalizeSecret(un *unstructured.Unstructured)
- type DiffResult
- type Normalizer
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTwoWayMergePatch ¶
CreateTwoWayMergePatch is a helper to construct a two-way merge patch from objects (instead of bytes)
func GetLastAppliedConfigAnnotation ¶
func GetLastAppliedConfigAnnotation(live *unstructured.Unstructured) (*unstructured.Unstructured, error)
func Normalize ¶
func Normalize(un *unstructured.Unstructured, opts ...Option)
func NormalizeSecret ¶
func NormalizeSecret(un *unstructured.Unstructured)
NormalizeSecret mutates the supplied object and encodes stringData to data, and converts nils to empty strings. If the object is not a secret, or is an invalid secret, then returns the same object.
Types ¶
type DiffResult ¶
type DiffResult struct { // Modified is set to true if resources are not matching Modified bool // Contains YAML representation of a live resource with applied normalizations NormalizedLive string // Contains "expected" YAML representation of a live resource PredictedLive string }
DiffResult holds diffing result of two resources
func Diff ¶
func Diff(config, live *unstructured.Unstructured, opts ...Option) (*DiffResult, error)
Diff performs a diff on two unstructured objects. If the live object happens to have a "kubectl.kubernetes.io/last-applied-configuration", then perform a three way diff.
func ThreeWayDiff ¶
func ThreeWayDiff(orig, config, live *unstructured.Unstructured) (*DiffResult, error)
ThreeWayDiff performs a diff with the understanding of how to incorporate the last-applied-configuration annotation in the diff. Inputs are assumed to be stripped of type information
func TwoWayDiff ¶
func TwoWayDiff(config, live *unstructured.Unstructured) (*DiffResult, error)
TwoWayDiff performs a three-way diff and uses specified config as a recently applied config
type Normalizer ¶
type Normalizer interface {
Normalize(un *unstructured.Unstructured) error
}
Normalizer updates resource before comparing it
func GetNoopNormalizer ¶
func GetNoopNormalizer() Normalizer
GetNoopNormalizer returns normalizer that does not apply any resource modifications
func NewDefaultIgnoreNormalizer ¶
func NewDefaultIgnoreNormalizer(paths []string) (Normalizer, error)
NewDefaultIgnoreNormalizer creates diff normalizer which removes ignored fields according to given json path
type Option ¶
type Option func(*Options)
Option is a function used as arguments to New in order to configure the resulting diff Options.
func WithNormalizer ¶
func WithNormalizer(normalizer Normalizer) Option