var metadataAccessor … // GetOriginalConfiguration retrieves the original configuration of the object // from the annotation, or nil if no annotation was found. func GetOriginalConfiguration(obj runtime.Object) ([]byte, error) { … } // SetOriginalConfiguration sets the original configuration of the object // as the annotation on the object for later use in computing a three way patch. func setOriginalConfiguration(obj runtime.Object, original []byte) error { … } // GetModifiedConfiguration retrieves the modified configuration of the object. // If annotate is true, it embeds the result as an annotation in the modified // configuration. If an object was read from the command input, it will use that // version of the object. Otherwise, it will use the version from the server. func GetModifiedConfiguration(obj runtime.Object, annotate bool, codec runtime.Encoder) ([]byte, error) { … } // updateApplyAnnotation calls CreateApplyAnnotation if the last applied // configuration annotation is already present. Otherwise, it does nothing. func updateApplyAnnotation(obj runtime.Object, codec runtime.Encoder) error { … } // CreateApplyAnnotation gets the modified configuration of the object, // without embedding it again, and then sets it on the object as the annotation. func CreateApplyAnnotation(obj runtime.Object, codec runtime.Encoder) error { … } // CreateOrUpdateAnnotation creates the annotation used by // kubectl apply only when createAnnotation is true // Otherwise, only update the annotation when it already exists func CreateOrUpdateAnnotation(createAnnotation bool, obj runtime.Object, codec runtime.Encoder) error { … }