{"modulePath":"github.com/argoproj/gitops-engine","version":"v0.7.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package diff\n\nThe package provide functions that allows to compare set of Kubernetes resources using the logic equivalent to \\`kubectl diff\\`.\n\n## Functions\n\n```go\nfunc CreateTwoWayMergePatch(orig, new, dataStruct interface{}) ([]byte, bool, error)\n```\nCreateTwoWayMergePatch is a helper to construct a two-way merge patch from objects (instead of bytes)\n\n```go\nfunc GetLastAppliedConfigAnnotation(live *unstructured.Unstructured) (*unstructured.Unstructured, error)\n```\n\n```go\nfunc HideSecretData(target *unstructured.Unstructured, live *unstructured.Unstructured) (*unstructured.Unstructured, *unstructured.Unstructured, error)\n```\nHideSecretData 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.\n\n```go\nfunc Normalize(un *unstructured.Unstructured, opts ...Option)\n```\n\n```go\nfunc NormalizeSecret(un *unstructured.Unstructured, opts ...Option)\n```\nNormalizeSecret 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.\n\n## Types\n\n```go\ntype DiffResult struct {\n\t// Modified is set to true if resources are not matching\n\tModified bool\n\t// Contains YAML representation of a live resource with applied normalizations\n\tNormalizedLive []byte\n\t// Contains \"expected\" YAML representation of a live resource\n\tPredictedLive []byte\n}\n```\nHolds diffing result of two resources\n\n```go\nfunc Diff(config, live *unstructured.Unstructured, opts ...Option) (*DiffResult, error)\n```\nDiff 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.\n\n```go\nfunc ThreeWayDiff(orig, config, live *unstructured.Unstructured) (*DiffResult, error)\n```\nThreeWayDiff 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\n\n```go\nfunc TwoWayDiff(config, live *unstructured.Unstructured) (*DiffResult, error)\n```\nTwoWayDiff performs a three-way diff and uses specified config as a recently applied config\n\n```go\ntype DiffResultList struct {\n\tDiffs    []DiffResult\n\tModified bool\n}\n```\nHolds result of two resources sets comparison\n\n```go\nfunc DiffArray(configArray, liveArray []*unstructured.Unstructured, opts ...Option) (*DiffResultList, error)\n```\nDiffArray performs a diff on a list of unstructured objects. Objects are expected to match environments\n\n```go\ntype Normalizer interface {\n\tNormalize(un *unstructured.Unstructured) error\n}\n```\nNormalizer updates resource before comparing it\n\n```go\nfunc GetNoopNormalizer() Normalizer\n```\nGetNoopNormalizer returns normalizer that does not apply any resource modifications\n\n```go\ntype Option func(*options)\n```\n\n```go\nfunc IgnoreAggregatedRoles(ignore bool) Option\n```\n\n```go\nfunc WithLogr(log logr.Logger) Option\n```\n\n```go\nfunc WithNormalizer(normalizer Normalizer) Option\n```\n\n","path":"github.com/argoproj/gitops-engine/pkg/diff","name":"diff","synopsis":"The package provide functions that allows to compare set of Kubernetes resources using the logic equivalent to `kubectl diff`.","isRedistributable":true}
