Documentation ¶
Index ¶
- func CreateTwoWayMergePatch(orig, new, dataStruct interface{}) ([]byte, bool, error)
- func GetLastAppliedConfigAnnotation(live *unstructured.Unstructured) *unstructured.Unstructured
- func HideSecretData(target *unstructured.Unstructured, live *unstructured.Unstructured) (*unstructured.Unstructured, *unstructured.Unstructured, error)
- func Normalize(un *unstructured.Unstructured, normalizer Normalizer)
- func NormalizeSecret(un *unstructured.Unstructured)
- type DiffResult
- type DiffResultList
- type Normalizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTwoWayMergePatch ¶ added in v0.11.0
CreateTwoWayMergePatch is a helper to construct a two-way merge patch from objects (instead of bytes)
func GetLastAppliedConfigAnnotation ¶ added in v0.11.0
func GetLastAppliedConfigAnnotation(live *unstructured.Unstructured) *unstructured.Unstructured
func HideSecretData ¶ added in v0.12.0
func HideSecretData(target *unstructured.Unstructured, live *unstructured.Unstructured) (*unstructured.Unstructured, *unstructured.Unstructured, error)
HideSecretData replaces secret data values in specified target, live secrets and in last applied configuration of live secret with stars. Also preserves differences between target, live and last applied config values. E.g. if all three are equal the values would be replaced with same number of stars. If all the are different then number of stars in replacement should be different.
func Normalize ¶ added in v0.11.0
func Normalize(un *unstructured.Unstructured, normalizer Normalizer)
func NormalizeSecret ¶ added in v0.11.0
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 { Diff gojsondiff.Diff Modified bool }
func Diff ¶
func Diff(config, live *unstructured.Unstructured, normalizer Normalizer) *DiffResult
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 ¶ added in v0.4.0
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 ¶ added in v0.4.0
func TwoWayDiff(config, live *unstructured.Unstructured) *DiffResult
TwoWayDiff performs a normal two-way diff between two unstructured objects. Ignores extra fields in the live object. Inputs are assumed to be stripped of type information
func (*DiffResult) ASCIIFormat ¶
func (d *DiffResult) ASCIIFormat(left *unstructured.Unstructured, formatOpts formatter.AsciiFormatterConfig) (string, error)
ASCIIFormat returns the ASCII format of the diff
func (*DiffResult) JSONFormat ¶ added in v0.11.0
func (d *DiffResult) JSONFormat() (string, error)
JSONFormat returns the diff as a JSON string
type DiffResultList ¶
type DiffResultList struct { Diffs []DiffResult Modified bool }
func DiffArray ¶
func DiffArray(configArray, liveArray []*unstructured.Unstructured, normalizer Normalizer) (*DiffResultList, error)
DiffArray performs a diff on a list of unstructured objects. Objects are expected to match environments
type Normalizer ¶ added in v0.12.0
type Normalizer interface {
Normalize(un *unstructured.Unstructured) (*unstructured.Unstructured, error)
}