diff creates a patch.
(original, modified runtime.Object)
| 411 | |
| 412 | // diff creates a patch. |
| 413 | func diff(original, modified runtime.Object) (patch []byte, err error) { |
| 414 | origBytes, err := json.Marshal(original) |
| 415 | if err != nil { |
| 416 | return nil, err |
| 417 | } |
| 418 | |
| 419 | modBytes, err := json.Marshal(modified) |
| 420 | if err != nil { |
| 421 | return nil, err |
| 422 | } |
| 423 | |
| 424 | return strategicpatch.CreateTwoWayMergePatch(origBytes, modBytes, original) |
| 425 | } |
| 426 | |
| 427 | // asKubeObject attempts use the object as a KubeObject. It will return an error if not possible. |
| 428 | func AsKubeObject(runtimeObj runtime.Object) (KubeObject, error) { |