type VersionedAttributes … // GetObject overrides the Attributes.GetObject() func (v *VersionedAttributes) GetObject() runtime.Object { … } // ConvertToGVK converts object to the desired gvk. func ConvertToGVK(obj runtime.Object, gvk schema.GroupVersionKind, o ObjectInterfaces) (runtime.Object, error) { … } // NewVersionedAttributes returns versioned attributes with the old and new object (if non-nil) converted to the requested kind func NewVersionedAttributes(attr Attributes, gvk schema.GroupVersionKind, o ObjectInterfaces) (*VersionedAttributes, error) { … } // ConvertVersionedAttributes converts VersionedObject and VersionedOldObject to the specified kind, if needed. // If attr.VersionedKind already matches the requested kind, no conversion is performed. // If conversion is required: // * attr.VersionedObject is used as the source for the new object if Dirty=true (and is round-tripped through attr.Attributes.Object, clearing Dirty in the process) // * attr.Attributes.Object is used as the source for the new object if Dirty=false // * attr.Attributes.OldObject is used as the source for the old object func ConvertVersionedAttributes(attr *VersionedAttributes, gvk schema.GroupVersionKind, o ObjectInterfaces) error { … }