MCPcopy
hub / github.com/redspread/spread / diff

Function diff

pkg/deploy/cluster.go:413–425  ·  view source on GitHub ↗

diff creates a patch.

(original, modified runtime.Object)

Source from the content-addressed store, hash-verified

411
412// diff creates a patch.
413func 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.
428func AsKubeObject(runtimeObj runtime.Object) (KubeObject, error) {

Callers 1

updateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected