diff

package
v0.37.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DefaultDiffTypes is the default set of jsondiff.DiffType types to include in summaries.

Functions

func ResourceName added in v0.37.0

func ResourceName(obj client.Object) string

ResourceName returns the resource name in the format `kind/namespace/name`.

func SummarizeDiffSet added in v0.37.0

func SummarizeDiffSet(set jsondiff.DiffSet, include ...jsondiff.DiffType) string

SummarizeDiffSet returns a summary of the given DiffSet, including only the given jsondiff.DiffType types. If no types are given, the DefaultDiffTypes set is used.

The summary is a string with one line per Diff, in the format: `Kind/namespace/name: <summary>`

Where summary is one of:

  • unchanged
  • removed
  • excluded
  • changed (x added, y changed, z removed)

For example:

Deployment/default/hello-world changed (1 added, 1 changed, 1 removed)
Deployment/default/hello-world2 removed
Deployment/default/hello-world3 excluded
Deployment/default/hello-world4 unchanged

func SummarizeDiffSetBrief added in v0.37.0

func SummarizeDiffSetBrief(set jsondiff.DiffSet, include ...jsondiff.DiffType) string

SummarizeDiffSetBrief returns a brief summary of the given DiffSet.

The summary is a string in the format:

removed: x, changed: y, excluded: z, unchanged: w

For example:

removed: 1, changed: 3, excluded: 1, unchanged: 2

func Unstructured added in v0.37.0

func Unstructured(x, y *unstructured.Unstructured, opts ...CompareOption) (string, bool)

Unstructured compares two unstructured objects and returns a diff and a bool indicating whether the objects are equal.

Types

type CompareOption added in v0.37.0

type CompareOption func(u *unstructured.Unstructured)

CompareOption is a function that modifies the unstructured object before comparing.

func WithoutStatus added in v0.37.0

func WithoutStatus() CompareOption

WithoutStatus removes the status field from the unstructured object before comparing.

Jump to

Keyboard shortcuts

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