code: func GetApplyPatch(obj runtime.Unstructured) ([]byte, []byte, types.PatchType, error) {
  	beforeJSON, err := encodeToJSON(obj)
  	if err != nil {
  		return nil, []byte(""), types.MergePatchType, err
  	}
  	objCopy := obj.DeepCopyObject()
  	accessor := meta.NewAccessor()
  	annotations, err := accessor.Annotations(objCopy)
  	if err != nil {
  		return nil, beforeJSON, types.MergePatchType, err
  	}
  	if annotations == nil {
  		annotations = map[string]string{}
  	}
  	annotations[corev1.LastAppliedConfigAnnotation] = string(beforeJSON)
  	accessor.SetAnnotations(objCopy, annotations)
  	afterJSON, err := encodeToJSON(objCopy.(runtime.Unstructured))
  	if err != nil {
  		return nil, beforeJSON, types.MergePatchType, err
  	}
  	patch, err := jsonpatch.CreateMergePatch(beforeJSON, afterJSON)
  	return patch, beforeJSON, types.MergePatchType, err
  }
docs: // GetApplyPatch is used to get and apply patches