From 0eec665da46f7245d031698ec9736c19b9aa44a3 Mon Sep 17 00:00:00 2001 From: Phani Teja Marupaka Date: Thu, 2 Dec 2021 16:29:33 -0800 Subject: [PATCH] Add cnrm annotation to merge3 --- internal/util/merge/merge3.go | 3 ++- internal/util/update/resource-merge.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/util/merge/merge3.go b/internal/util/merge/merge3.go index 4ca77ab9b1..75ce44809c 100644 --- a/internal/util/merge/merge3.go +++ b/internal/util/merge/merge3.go @@ -18,6 +18,7 @@ import ( "path/filepath" "strings" + "github.com/GoogleContainerTools/kpt/internal/util/attribution" kptfilev1 "github.com/GoogleContainerTools/kpt/pkg/api/kptfile/v1" "sigs.k8s.io/kustomize/kyaml/kio" "sigs.k8s.io/kustomize/kyaml/kio/filters" @@ -357,7 +358,7 @@ func (*resourceHandler) equals(r1, r2 *yaml.RNode) (bool, error) { func stripKyamlAnnos(n *yaml.RNode) error { for _, a := range []string{mergeSourceAnnotation, kioutil.PathAnnotation, kioutil.IndexAnnotation, - kioutil.LegacyPathAnnotation, kioutil.LegacyIndexAnnotation} { + kioutil.LegacyPathAnnotation, kioutil.LegacyIndexAnnotation, attribution.CNRMMetricsAnnotation} { err := n.PipeE(yaml.ClearAnnotation(a)) if err != nil { return err diff --git a/internal/util/update/resource-merge.go b/internal/util/update/resource-merge.go index 64681bbe0b..da20a99087 100644 --- a/internal/util/update/resource-merge.go +++ b/internal/util/update/resource-merge.go @@ -25,6 +25,7 @@ import ( "github.com/GoogleContainerTools/kpt/internal/errors" "github.com/GoogleContainerTools/kpt/internal/pkg" "github.com/GoogleContainerTools/kpt/internal/types" + pkgdiff "github.com/GoogleContainerTools/kpt/internal/util/diff" "github.com/GoogleContainerTools/kpt/internal/util/merge" "github.com/GoogleContainerTools/kpt/internal/util/pkgutil" kptfilev1 "github.com/GoogleContainerTools/kpt/pkg/api/kptfile/v1" @@ -125,7 +126,7 @@ func (u ResourceMergeUpdater) updatePackage(subPkgPath, localPath, updatedPath, // Package deleted from upstream case originalExists && localExists && !updatedExists: // Check the diff. If there are local changes, we keep the subpackage. - diff, err := copyutil.Diff(originalPath, localPath) + diff, err := pkgdiff.PkgDiff(originalPath, localPath) if err != nil { return errors.E(op, types.UniquePath(localPath), err) }