Documentation ¶
Index ¶
- Variables
- func ResourceName(obj client.Object) string
- func SummarizeDiffSet(set jsondiff.DiffSet, include ...jsondiff.DiffType) string
- func SummarizeDiffSetBrief(set jsondiff.DiffSet, include ...jsondiff.DiffType) string
- func Unstructured(x, y *unstructured.Unstructured, opts ...CompareOption) (string, bool)
- type CompareOption
Constants ¶
This section is empty.
Variables ¶
var DefaultDiffTypes = []jsondiff.DiffType{ jsondiff.DiffTypeCreate, jsondiff.DiffTypeUpdate, jsondiff.DiffTypeExclude, }
DefaultDiffTypes is the default set of jsondiff.DiffType types to include in summaries.
Functions ¶
func ResourceName ¶ added in v0.37.0
ResourceName returns the resource name in the format `kind/namespace/name`.
func SummarizeDiffSet ¶ added in v0.37.0
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
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.