Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
func Diff(fromObject interface{}, toObject interface{}) string
Diff diffs two Golang objects recursively, but treats any elements whose values are empty in the 'fromObject' as "no diff". This is useful when comparing a desired Kubernetes object against a live Kubernetes object:
- The 'fromObject' is constructed via code, and doesn't specify a value for every nested field in the struct. Most Kubernetes object structs have an enormous number of fields, and it's not feasible to try to set them all when constructing the object. Also, note that some fields in the structs (like UUID, resourceVersion, or creationTime), are completely determined by Kubernetes at runtime.
- The 'toObject' has been retrieved via the Kubernetes API, and has had many of the fields that were unspecified in the fromObject populated with Kubernetes-generated values.
In this situation, to determine whether our fromObject is truly different than the toObject, we ignore processing of elements whose values are empty in the fromObject.
func IgnoreUnset ¶
Extended from https://github.com/kubernetes/apimachinery/blob/master/pkg/util/diff/diff.go IgnoreUnset return a cmp.Option to ignore changes for values that are unset in the toObject
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.