Skip to content

Instantly share code, notes, and snippets.

@nrb
Last active March 5, 2018 21:49
Show Gist options
  • Select an option

  • Save nrb/9c1bccee36f9d16cce8cf06d6ec9c477 to your computer and use it in GitHub Desktop.

Select an option

Save nrb/9c1bccee36f9d16cce8cf06d6ec9c477 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/strategicpatch"
)
func main() {
one := unstructured.Unstructured{Object: map[string]interface{}{
"key": "value1",
}}
two := unstructured.Unstructured{Object: map[string]interface{}{
"key": "value2",
}}
fmt.Println("one :", one)
fmt.Println("two: ", two)
patch, _ := strategicpatch.CreateTwoWayMergeMapPatch(one.Object, two.Object, unstructured.Unstructured{})
fmt.Println("patch: %v", patch)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment