Repository: GoogleContainerTools/kpt
Pull request #2603 (2021-12-01 21:00:51)

upgrade to kyaml 0.13.0+


Patch:
diff --git a/go.mod b/go.mod
index 6a48efa8..3e387586 100644
--- a/go.mod
+++ b/go.mod
@@ -15,15 +15,16 @@ require (
 	github.com/stretchr/testify v1.7.0
 	github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca
 	gotest.tools v2.2.0+incompatible
-	k8s.io/api v0.22.2
+	k8s.io/api v0.22.3
 	k8s.io/apiextensions-apiserver v0.22.2
-	k8s.io/apimachinery v0.22.2
+	k8s.io/apimachinery v0.22.3
 	k8s.io/cli-runtime v0.22.2
 	k8s.io/client-go v0.22.2
 	k8s.io/klog/v2 v2.10.0
+	k8s.io/kube-openapi v0.0.0-20211109043139-026bd182f079 // indirect
 	k8s.io/kubectl v0.22.2
 	k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e
 	sigs.k8s.io/cli-utils v0.26.1-0.20211020064957-d62b5c62002d
 	sigs.k8s.io/kustomize/api v0.8.11
-	sigs.k8s.io/kustomize/kyaml v0.12.1-0.20211012224254-55ac9ca88db9
+	sigs.k8s.io/kustomize/kyaml v0.13.1-0.20211203194734-cd2c6a1ad117
 )
diff --git a/go.sum b/go.sum
index 8634f219..b34fb99e 100644
--- a/go.sum
+++ b/go.sum
@@ -988,12 +988,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
 honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
 honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
-k8s.io/api v0.22.2 h1:M8ZzAD0V6725Fjg53fKeTJxGsJvRbk4TEm/fexHMtfw=
 k8s.io/api v0.22.2/go.mod h1:y3ydYpLJAaDI+BbSe2xmGcqxiWHmWjkEeIbiwHvnPR8=
+k8s.io/api v0.22.3 h1:wOoES2GoSkUsdped2RB4zYypPqWtvprGoKCENTOOjP4=
+k8s.io/api v0.22.3/go.mod h1:azgiXFiXqiWyLCfI62/eYBOu19rj2LKmIhFPP4+33fs=
 k8s.io/apiextensions-apiserver v0.22.2 h1:zK7qI8Ery7j2CaN23UCFaC1hj7dMiI87n01+nKuewd4=
 k8s.io/apiextensions-apiserver v0.22.2/go.mod h1:2E0Ve/isxNl7tWLSUDgi6+cmwHi5fQRdwGVCxbC+KFA=
-k8s.io/apimachinery v0.22.2 h1:ejz6y/zNma8clPVfNDLnPbleBo6MpoFy/HBiBqCouVk=
 k8s.io/apimachinery v0.22.2/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0=
+k8s.io/apimachinery v0.22.3 h1:mrvBG5CZnEfwgpVqWcrRKvdsYECTrhAR6cApAgdsflk=
+k8s.io/apimachinery v0.22.3/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0=
 k8s.io/apiserver v0.22.2/go.mod h1:vrpMmbyjWrgdyOvZTSpsusQq5iigKNWv9o9KlDAbBHI=
 k8s.io/cli-runtime v0.22.2 h1:fsd9rFk9FSaVq4SUq1fM27c8CFGsYZUJ/3BkgmjYWuY=
 k8s.io/cli-runtime v0.22.2/go.mod h1:tkm2YeORFpbgQHEK/igqttvPTRIHFRz5kATlw53zlMI=
@@ -1005,16 +1007,19 @@ k8s.io/component-base v0.22.2/go.mod h1:5Br2QhI9OTe79p+TzPe9JKNQYvEKbq9rTJDWllun
 k8s.io/component-helpers v0.22.2/go.mod h1:+N61JAR9aKYSWbnLA88YcFr9K/6ISYvRNybX7QW7Rs8=
 k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
 k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
+k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
 k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
 k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
 k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
 k8s.io/klog/v2 v2.10.0 h1:R2HDMDJsHVTHA2n4RjwbeYXdOcBymXdX/JRb1v0VGhE=
 k8s.io/klog/v2 v2.10.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
-k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e h1:KLHHjkdQFomZy8+06csTWZ0m1343QqxZhR2LJ1OxCYM=
 k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw=
+k8s.io/kube-openapi v0.0.0-20211109043139-026bd182f079 h1:Qvr4c6wr4iBZbZQY/IwkcJH04hpdzUt2zdJw4D7P/Ng=
+k8s.io/kube-openapi v0.0.0-20211109043139-026bd182f079/go.mod h1:X90lRFlqk35/w9FG4WIvZqMPfG3WrZGzdlSaL6uh7rc=
 k8s.io/kubectl v0.22.2 h1:KMyYNZoBshaL3XKx04X07DtpoD4vMrdkfiN/G2Qx/PU=
 k8s.io/kubectl v0.22.2/go.mod h1:BApg2j0edxLArCOfO0ievI27EeTQqBDMNU9VQH734iQ=
 k8s.io/metrics v0.22.2/go.mod h1:GUcsBtpsqQD1tKFS/2wCKu4ZBowwRncLOJH1rgWs3uw=
+k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e h1:ldQh+neBabomh7+89dTpiFAB8tGdfVmuIzAHbvtl+9I=
 k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
@@ -1032,8 +1037,10 @@ sigs.k8s.io/kustomize/cmd/config v0.9.13/go.mod h1:7547FLF8W/lTaDf0BDqFTbZxM9zqw
 sigs.k8s.io/kustomize/kustomize/v4 v4.2.0/go.mod h1:MOkR6fmhwG7hEDRXBYELTi5GSFcLwfqwzTRHW3kv5go=
 sigs.k8s.io/kustomize/kyaml v0.11.0/go.mod h1:GNMwjim4Ypgp/MueD3zXHLRJEjz7RvtPae0AwlvEMFM=
 sigs.k8s.io/kustomize/kyaml v0.12.0/go.mod h1:FTJxEZ86ScK184NpGSAQcfEqee0nul8oLCK30D47m4E=
-sigs.k8s.io/kustomize/kyaml v0.12.1-0.20211012224254-55ac9ca88db9 h1:YsD7ModmQptMeuSZW/ZOeV2/LLQaOYNUA3sx3yZQTa0=
-sigs.k8s.io/kustomize/kyaml v0.12.1-0.20211012224254-55ac9ca88db9/go.mod h1:FTJxEZ86ScK184NpGSAQcfEqee0nul8oLCK30D47m4E=
+sigs.k8s.io/kustomize/kyaml v0.13.1-0.20211122190718-01420768c8ef h1:+S4oQAuqVk4Nmy28fALpv93AgW0UKQWjmqUwSNmIWpE=
+sigs.k8s.io/kustomize/kyaml v0.13.1-0.20211122190718-01420768c8ef/go.mod h1:FTJxEZ86ScK184NpGSAQcfEqee0nul8oLCK30D47m4E=
+sigs.k8s.io/kustomize/kyaml v0.13.1-0.20211203194734-cd2c6a1ad117 h1:4ePwpEnROoPqjaY6WC98EiRpYrmJjDHV6KA7PGDmpdQ=
+sigs.k8s.io/kustomize/kyaml v0.13.1-0.20211203194734-cd2c6a1ad117/go.mod h1:FTJxEZ86ScK184NpGSAQcfEqee0nul8oLCK30D47m4E=
 sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
 sigs.k8s.io/structured-merge-diff/v4 v4.1.2 h1:Hr/htKFmJEbtMgS/UD0N+gtgctAqz81t3nu+sPzynno=
 sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
diff --git a/internal/cmdrender/executor.go b/internal/cmdrender/executor.go
index 098afa51..b321a90e 100644
--- a/internal/cmdrender/executor.go
+++ b/internal/cmdrender/executor.go
@@ -479,7 +479,7 @@ func adjustRelPath(hctx *hydrationContext) error {
 		if err = r.PipeE(yaml.SetAnnotation(kioutil.PathAnnotation, newPath)); err != nil {
 			return err
 		}
-		if err = r.PipeE(yaml.SetAnnotation(kioutil.LegacyPathAnnotation, newPath)); err != nil {
+		if err = r.PipeE(yaml.SetAnnotation(kioutil.LegacyPathAnnotation, newPath)); err != nil { // nolint:staticcheck
 			return err
 		}
 		if err = pkg.RemovePkgPathAnnotation(r); err != nil {
diff --git a/internal/fnruntime/runner.go b/internal/fnruntime/runner.go
index 532d679c..bdbaa1a3 100644
--- a/internal/fnruntime/runner.go
+++ b/internal/fnruntime/runner.go
@@ -224,21 +224,24 @@ func parseStructuredResult(yml *yaml.RNode, fnResult *fnresult.Result) error {
 		return err
 	}
 
-	return parseNameAndNamespace(yml, fnResult)
+	return migrateLegacyResult(yml, fnResult)
 }
 
-// parseNameAndNamespace populates name and namespace in fnResult.Result if a
+// migrateLegacyResult populates name and namespace in fnResult.Result if a
 // function (e.g. using kyaml Go SDKs) gives results in a schema
 // that puts a resourceRef's name and namespace under a metadata field
 // TODO: fix upstream (https://github.com/GoogleContainerTools/kpt/issues/2091)
-func parseNameAndNamespace(yml *yaml.RNode, fnResult *fnresult.Result) error {
+func migrateLegacyResult(yml *yaml.RNode, fnResult *fnresult.Result) error {
 	items, err := yml.Elements()
 	if err != nil {
 		return err
 	}
 
 	for i := range items {
-		if err := populateResourceRef(items[i], &fnResult.Results[i]); err != nil {
+		if err = populateResourceRef(items[i], fnResult.Results[i]); err != nil {
+			return err
+		}
+		if err = populateProposedValue(items[i], fnResult.Results[i]); err != nil {
 			return err
 		}
 	}
@@ -246,7 +249,22 @@ func parseNameAndNamespace(yml *yaml.RNode, fnResult *fnresult.Result) error {
 	return nil
 }
 
-func populateResourceRef(item *yaml.RNode, resultItem *framework.ResultItem) error {
+func populateProposedValue(item *yaml.RNode, resultItem *framework.Result) error {
+	sv, err := item.Pipe(yaml.Lookup("field", "suggestedValue"))
+	if err != nil {
+		return err
+	}
+	if sv == nil {
+		return nil
+	}
+	if resultItem.Field == nil {
+		resultItem.Field = &framework.Field{}
+	}
+	resultItem.Field.ProposedValue = sv
+	return nil
+}
+
+func populateResourceRef(item *yaml.RNode, resultItem *framework.Result) error {
 	r, err := item.Pipe(yaml.Lookup("resourceRef", "metadata"))
 	if err != nil {
 		return err
@@ -282,7 +300,7 @@ func printFnResult(ctx context.Context, fnResult *fnresult.Result, opt *printer.
 		// function returned structured results
 		var lines []string
 		for _, item := range fnResult.Results {
-			lines = append(lines, resultToString(item))
+			lines = append(lines, item.String())
 		}
 		ri := &multiLineFormatter{
 			Title:          "Results",
@@ -402,57 +420,6 @@ func (ri *multiLineFormatter) String() string {
 	return b.String()
 }
 
-// resultToString converts given structured result item to string format.
-func resultToString(result framework.ResultItem) string {
-	// TODO: Go SDK should implement Stringer method
-	// for framework.ResultItem. This is a temporary
-	// wrapper that will eventually be moved to Go SDK.
-
-	defaultSeverity := "info"
-
-	s := strings.Builder{}
-
-	severity := defaultSeverity
-
-	if string(result.Severity) != "" {
-		severity = string(result.Severity)
-	}
-	s.WriteString(fmt.Sprintf("[%s] %s", strings.ToUpper(severity), result.Message))
-
-	resourceID := resourceRefToString(result.ResourceRef)
-	if resourceID != "" {
-		// if an object is involved
-		s.WriteString(fmt.Sprintf(" in object %q", resourceID))
-	}
-
-	if result.File.Path != "" {
-		s.WriteString(fmt.Sprintf(" in file %q", result.File.Path))
-	}
-
-	if result.Field.Path != "" {
-		s.WriteString(fmt.Sprintf(" in field %q", result.Field.Path))
-	}
-
-	return s.String()
-}
-
-func resourceRefToString(ref yaml.ResourceIdentifier) string {
-	s := strings.Builder{}
-	if ref.APIVersion != "" {
-		s.WriteString(fmt.Sprintf("%s/", ref.APIVersion))
-	}
-	if ref.Kind != "" {
-		s.WriteString(fmt.Sprintf("%s/", ref.Kind))
-	}
-	if ref.Namespace != "" {
-		s.WriteString(fmt.Sprintf("%s/", ref.Namespace))
-	}
-	if ref.Name != "" {
-		s.WriteString(ref.Name)
-	}
-	return s.String()
-}
-
 func newFnConfig(f *kptfilev1.Function, pkgPath types.UniquePath) (*yaml.RNode, error) {
 	const op errors.Op = "fn.readConfig"
 	var fn errors.Fn = errors.Fn(f.Image)
diff --git a/internal/util/cmdutil/cmdutil.go b/internal/util/cmdutil/cmdutil.go
index 5a365c30..8fda513e 100644
--- a/internal/util/cmdutil/cmdutil.go
+++ b/internal/util/cmdutil/cmdutil.go
@@ -165,7 +165,7 @@ func WriteToOutput(r io.Reader, w io.Writer, outDir string) error {
 		outputs = []kio.Writer{&kio.ByteWriter{
 			Writer: w,
 			ClearAnnotations: []string{kioutil.IndexAnnotation, kioutil.PathAnnotation,
-				kioutil.LegacyIndexAnnotation, kioutil.LegacyPathAnnotation}},
+				kioutil.LegacyIndexAnnotation, kioutil.LegacyPathAnnotation}}, // nolint:staticcheck
 		}
 	}
 
diff --git a/internal/util/merge/merge3.go b/internal/util/merge/merge3.go
index 75ce4480..effdf27b 100644
--- a/internal/util/merge/merge3.go
+++ b/internal/util/merge/merge3.go
@@ -358,7 +358,8 @@ 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, attribution.CNRMMetricsAnnotation} {
+		kioutil.LegacyPathAnnotation, kioutil.LegacyIndexAnnotation, // nolint:staticcheck
+		kioutil.InternalAnnotationsMigrationResourceIDAnnotation, attribution.CNRMMetricsAnnotation} {
 		err := n.PipeE(yaml.ClearAnnotation(a))
 		if err != nil {
 			return err
diff --git a/pkg/api/fnresult/v1/types.go b/pkg/api/fnresult/v1/types.go
index fb125c52..e6dc7848 100644
--- a/pkg/api/fnresult/v1/types.go
+++ b/pkg/api/fnresult/v1/types.go
@@ -38,7 +38,7 @@ type Result struct {
 	// ExitCode is the exit code from running the function
 	ExitCode int `yaml:"exitCode"`
 	// Results is the list of results for the function
-	Results []framework.ResultItem `yaml:"results,omitempty"`
+	Results framework.Results `yaml:"results,omitempty"`
 }
 
 const (
diff --git a/pkg/live/rgpath.go b/pkg/live/rgpath.go
index 1abd36c8..99d32a3b 100644
--- a/pkg/live/rgpath.go
+++ b/pkg/live/rgpath.go
@@ -57,7 +57,7 @@ func (r *ResourceGroupPathManifestReader) Read() ([]*unstructured.Unstructured,
 			continue
 		}
 
-		if err := removeAnnotations(n, kioutil.IndexAnnotation, kioutil.LegacyIndexAnnotation); err != nil {
+		if err := removeAnnotations(n, kioutil.IndexAnnotation, kioutil.LegacyIndexAnnotation); err != nil { // nolint:staticcheck
 			return objs, err
 		}
 		u, err := kyamlNodeToUnstructured(n)
diff --git a/pkg/live/rgstream.go b/pkg/live/rgstream.go
index 6e83c825..2ea25966 100644
--- a/pkg/live/rgstream.go
+++ b/pkg/live/rgstream.go
@@ -55,7 +55,7 @@ func (p *ResourceGroupStreamManifestReader) Read() ([]*unstructured.Unstructured
 			continue
 		}
 
-		err = removeAnnotations(n, kioutil.IndexAnnotation, kioutil.LegacyIndexAnnotation)
+		err = removeAnnotations(n, kioutil.IndexAnnotation, kioutil.LegacyIndexAnnotation) // nolint:staticcheck
 		if err != nil {
 			return objs, err
 		}
diff --git a/site/book/03-packages/08-publishing-a-package.md b/site/book/03-packages/08-publishing-a-package.md
index 9de94703..1cd2ddbf 100644
--- a/site/book/03-packages/08-publishing-a-package.md
+++ b/site/book/03-packages/08-publishing-a-package.md
@@ -20,7 +20,7 @@ $ git tag v0.1
 Push the commit which requires you to have access to the repo:
 
 ```shell
-$ git push v0.1
+$ git push origin v0.1
 ```
 
 You can then fetch the published package:
@@ -46,7 +46,7 @@ $ git tag packages/wordpress/v0.1
 Push the commit:
 
 ```shell
-$ git push packages/wordpress/v0.1
+$ git push origin packages/wordpress/v0.1
 ```
 
 You can then fetch the published package:
diff --git a/thirdparty/cmdconfig/commands/cmdsource/cmdsource.go b/thirdparty/cmdconfig/commands/cmdsource/cmdsource.go
index 52603b5c..16cab807 100644
--- a/thirdparty/cmdconfig/commands/cmdsource/cmdsource.go
+++ b/thirdparty/cmdconfig/commands/cmdsource/cmdsource.go
@@ -127,7 +127,7 @@ func (r *SourceRunner) runE(c *cobra.Command, args []string) error {
 			Writer:         printer.FromContextOrDie(r.Ctx).OutStream(),
 			FunctionConfig: functionConfig,
 			ClearAnnotations: []string{kioutil.IndexAnnotation, kioutil.PathAnnotation,
-				kioutil.LegacyPathAnnotation, kioutil.LegacyIndexAnnotation},
+				kioutil.LegacyPathAnnotation, kioutil.LegacyIndexAnnotation}, // nolint:staticcheck
 		})
 	}
 


Test patch:
diff --git a/e2e/testdata/fn-eval/error-in-pipe/.expected/config.yaml b/e2e/testdata/fn-eval/error-in-pipe/.expected/config.yaml
index 1fe965f6..21480468 100644
--- a/e2e/testdata/fn-eval/error-in-pipe/.expected/config.yaml
+++ b/e2e/testdata/fn-eval/error-in-pipe/.expected/config.yaml
@@ -17,7 +17,7 @@ stdErr: |
   [RUNNING] "gcr.io/kpt-fn/set-namespace:v0.1.3"
   [FAIL] "gcr.io/kpt-fn/set-namespace:v0.1.3" in 0s
     Results:
-      [ERROR] failed to configure function: input namespace cannot be empty
+      [error]: failed to configure function: input namespace cannot be empty
     Stderr:
       "[error] /// : failed to configure function: input namespace cannot be empty"
     Exit code: 1
diff --git a/e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/config.yaml b/e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/config.yaml
index 47dbb055..8ba1990f 100644
--- a/e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/config.yaml
+++ b/e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/config.yaml
@@ -6,7 +6,7 @@ stdErr: |
   [RUNNING] "gcr.io/kpt-fn/set-labels:v0.1.3"
   [PASS] "gcr.io/kpt-fn/set-labels:v0.1.3" in 0s
 stdOut: |
-  apiVersion: config.kubernetes.io/v1alpha1
+  apiVersion: config.kubernetes.io/v1
   kind: ResourceList
   items:
   # Copyright 2021 Google LLC
diff --git a/e2e/testdata/fn-eval/output-to-stdout/.expected/config.yaml b/e2e/testdata/fn-eval/output-to-stdout/.expected/config.yaml
index 3c6be816..79bfb94b 100644
--- a/e2e/testdata/fn-eval/output-to-stdout/.expected/config.yaml
+++ b/e2e/testdata/fn-eval/output-to-stdout/.expected/config.yaml
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 stdOut: |
-  apiVersion: config.kubernetes.io/v1alpha1
+  apiVersion: config.kubernetes.io/v1
   kind: ResourceList
   items:
   - # Copyright 2021 Google LLC
diff --git a/e2e/testdata/fn-eval/structured-results-in-stdout/.expected/config.yaml b/e2e/testdata/fn-eval/structured-results-in-stdout/.expected/config.yaml
index 72b28254..c47fc659 100644
--- a/e2e/testdata/fn-eval/structured-results-in-stdout/.expected/config.yaml
+++ b/e2e/testdata/fn-eval/structured-results-in-stdout/.expected/config.yaml
@@ -20,4 +20,4 @@ testType: eval
 image: gcr.io/kpt-fn/search-replace:v0.1
 fnConfig: ../search-replace-conf.yaml
 # Non-error messages should be printed to stderr
-stdErr: "[INFO]"
+stdErr: "[info]"
diff --git a/e2e/testdata/fn-render/fn-failure-output-no-truncate/.expected/config.yaml b/e2e/testdata/fn-render/fn-failure-output-no-truncate/.expected/config.yaml
index 39ff35a6..805fda8c 100644
--- a/e2e/testdata/fn-render/fn-failure-output-no-truncate/.expected/config.yaml
+++ b/e2e/testdata/fn-render/fn-failure-output-no-truncate/.expected/config.yaml
@@ -16,4 +16,4 @@
 # non-zero exit code and no changes in the resources.
 exitCode: 1
 disableOutputTruncate: true
-stdErr: '[ERROR] Invalid type. Expected: [integer,null], given: string in object "apps/v1/Deployment/nginx-deployment" in file "resources.yaml" in field "spec.replicas"'
+stdErr: '[error] apps/v1/Deployment/nginx-deployment spec.replicas: Invalid type. Expected: [integer,null], given: string'
diff --git a/e2e/testdata/fn-render/fn-failure/.expected/config.yaml b/e2e/testdata/fn-render/fn-failure/.expected/config.yaml
index cd8c3db9..0da7f168 100644
--- a/e2e/testdata/fn-render/fn-failure/.expected/config.yaml
+++ b/e2e/testdata/fn-render/fn-failure/.expected/config.yaml
@@ -19,6 +19,6 @@ stdErr: |
   [RUNNING] "gcr.io/kpt-fn/starlark:v0.2.1"
   [FAIL] "gcr.io/kpt-fn/starlark:v0.2.1" in 0s
     Results:
-      [ERROR] httpbin-gen:4:1: got newline, want primary expression
+      [error]: httpbin-gen:4:1: got newline, want primary expression
     Stderr:
       "[error] : httpbin-gen:4:1: got newline, want primary expression"
diff --git a/e2e/testdata/fn-render/fnresult-fn-failure/.expected/config.yaml b/e2e/testdata/fn-render/fnresult-fn-failure/.expected/config.yaml
index f62684eb..7c9cbaf3 100644
--- a/e2e/testdata/fn-render/fnresult-fn-failure/.expected/config.yaml
+++ b/e2e/testdata/fn-render/fnresult-fn-failure/.expected/config.yaml
@@ -15,4 +15,4 @@
 # One of the functions in the pipeline fails resulting in
 # non-zero exit code and no changes in the resources.
 exitCode: 1
-stdErr: '[ERROR] Invalid type. Expected: [integer,null], given: string in object "apps/v1/Deployment/nginx-deployment" in file "resources.yaml" in field "spec.replicas"'
+stdErr: '[error] apps/v1/Deployment/nginx-deployment spec.replicas: Invalid type. Expected: [integer,null], given: string'
diff --git a/e2e/testdata/fn-render/kubeval-failure/.expected/config.yaml b/e2e/testdata/fn-render/kubeval-failure/.expected/config.yaml
index c8925faf..b257d428 100644
--- a/e2e/testdata/fn-render/kubeval-failure/.expected/config.yaml
+++ b/e2e/testdata/fn-render/kubeval-failure/.expected/config.yaml
@@ -15,4 +15,3 @@
 # One of the functions in the pipeline fails resulting in
 # non-zero exit code and no changes in the resources.
 exitCode: 1
-stdErr: '[ERROR] selector is required in object "apps/v1/Deployment/nginx-deployment" in file "resources.yaml" in field "selector"'
diff --git a/e2e/testdata/fn-render/out-of-place-fnchain-stdout-results/.expected/config.yaml b/e2e/testdata/fn-render/out-of-place-fnchain-stdout-results/.expected/config.yaml
index f99568bd..2ce82921 100644
--- a/e2e/testdata/fn-render/out-of-place-fnchain-stdout-results/.expected/config.yaml
+++ b/e2e/testdata/fn-render/out-of-place-fnchain-stdout-results/.expected/config.yaml
@@ -1,5 +1,5 @@
 stdOut: |
-  apiVersion: config.kubernetes.io/v1alpha1
+  apiVersion: config.kubernetes.io/v1
   kind: ResourceList
   items:
   # Copyright 2021 Google LLC
diff --git a/e2e/testdata/fn-render/out-of-place-fnchain-stdout/.expected/config.yaml b/e2e/testdata/fn-render/out-of-place-fnchain-stdout/.expected/config.yaml
index aa1d01fe..6d080b0c 100644
--- a/e2e/testdata/fn-render/out-of-place-fnchain-stdout/.expected/config.yaml
+++ b/e2e/testdata/fn-render/out-of-place-fnchain-stdout/.expected/config.yaml
@@ -8,7 +8,7 @@ stdErr: |
   [PASS] "gcr.io/kpt-fn/set-labels:v0.1.3" in 0s
 
 stdOut: |
-  apiVersion: config.kubernetes.io/v1alpha1
+  apiVersion: config.kubernetes.io/v1
   kind: ResourceList
   items:
   # Copyright 2021 Google LLC
diff --git a/e2e/testdata/fn-render/out-of-place-stdout/.expected/config.yaml b/e2e/testdata/fn-render/out-of-place-stdout/.expected/config.yaml
index 51059413..9e516bdc 100644
--- a/e2e/testdata/fn-render/out-of-place-stdout/.expected/config.yaml
+++ b/e2e/testdata/fn-render/out-of-place-stdout/.expected/config.yaml
@@ -3,7 +3,7 @@ stdErr: |
   [PASS] "gcr.io/kpt-fn/set-namespace:v0.1.3" in 0s
 
 stdOut: |
-  apiVersion: config.kubernetes.io/v1alpha1
+  apiVersion: config.kubernetes.io/v1
   kind: ResourceList
   items:
   # Copyright 2021 Google LLC
diff --git a/e2e/testdata/fn-source/subpkgs-with-krmignore/.expected/config.yaml b/e2e/testdata/fn-source/subpkgs-with-krmignore/.expected/config.yaml
index 1d55f23d..79b950dd 100644
--- a/e2e/testdata/fn-source/subpkgs-with-krmignore/.expected/config.yaml
+++ b/e2e/testdata/fn-source/subpkgs-with-krmignore/.expected/config.yaml
@@ -1,5 +1,5 @@
 stdOut: |-
-  apiVersion: config.kubernetes.io/v1alpha1
+  apiVersion: config.kubernetes.io/v1
   kind: ResourceList
   items:
   - # Copyright 2021 Google LLC
diff --git a/internal/fnruntime/runner_test.go b/internal/fnruntime/runner_test.go
index 9c7494e3..8c3e7494 100644
--- a/internal/fnruntime/runner_test.go
+++ b/internal/fnruntime/runner_test.go
@@ -567,7 +567,7 @@ file:
 		yml, err := yaml.Parse(tc.input)
 		assert.NoError(t, err)
 
-		result := &framework.ResultItem{}
+		result := &framework.Result{}
 		err = yaml.Unmarshal([]byte(tc.input), result)
 		assert.NoError(t, err)
 		assert.NoError(t, populateResourceRef(yml, result))
diff --git a/internal/util/cmdutil/cmdutil_test.go b/internal/util/cmdutil/cmdutil_test.go
index fda429de..8fe1a91d 100644
--- a/internal/util/cmdutil/cmdutil_test.go
+++ b/internal/util/cmdutil/cmdutil_test.go
@@ -40,7 +40,7 @@ func TestWriteFnOutput(t *testing.T) {
 			name:   "wrapped output to stdout",
 			dest:   "stdout",
 			writer: bytes.Buffer{},
-			content: `apiVersion: config.kubernetes.io/v1alpha1
+			content: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
@@ -58,7 +58,7 @@ items:
         internal.config.kubernetes.io/index: '0'
         internal.config.kubernetes.io/path: 'svc.yaml'
 `,
-			expectedStdout: `apiVersion: config.kubernetes.io/v1alpha1
+			expectedStdout: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
@@ -81,7 +81,7 @@ items:
 			name:   "unwrapped output to stdout",
 			dest:   "unwrap",
 			writer: bytes.Buffer{},
-			content: `apiVersion: config.kubernetes.io/v1alpha1
+			content: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
@@ -113,7 +113,7 @@ metadata:
 		{
 			name: "output to another directory",
 			dest: "foo/bar",
-			content: `apiVersion: config.kubernetes.io/v1alpha1
+			content: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
@@ -152,7 +152,7 @@ metadata:
 			name:      "wrapped output to stdout by default if input is from stdin",
 			fromStdin: true,
 			writer:    bytes.Buffer{},
-			content: `apiVersion: config.kubernetes.io/v1alpha1
+			content: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
@@ -170,7 +170,7 @@ items:
         internal.config.kubernetes.io/index: '0'
         internal.config.kubernetes.io/path: 'svc.yaml'
 `,
-			expectedStdout: `apiVersion: config.kubernetes.io/v1alpha1
+			expectedStdout: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
@@ -194,7 +194,7 @@ items:
 			fromStdin: true,
 			dest:      "unwrap",
 			writer:    bytes.Buffer{},
-			content: `apiVersion: config.kubernetes.io/v1alpha1
+			content: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
@@ -227,7 +227,7 @@ metadata:
 			name:      "output to directory for input from stdin",
 			fromStdin: true,
 			dest:      "foo/bar",
-			content: `apiVersion: config.kubernetes.io/v1alpha1
+			content: `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
   - apiVersion: apps/v1
diff --git a/thirdparty/cmdconfig/commands/cmdsink/cmdsink_test.go b/thirdparty/cmdconfig/commands/cmdsink/cmdsink_test.go
index c2916c0e..f9667184 100644
--- a/thirdparty/cmdconfig/commands/cmdsink/cmdsink_test.go
+++ b/thirdparty/cmdconfig/commands/cmdsink/cmdsink_test.go
@@ -26,7 +26,7 @@ func TestSinkCommand(t *testing.T) {
 	os.RemoveAll(d)
 
 	r := GetSinkRunner(fake.CtxWithDefaultPrinter(), "")
-	r.Command.SetIn(bytes.NewBufferString(`apiVersion: config.kubernetes.io/v1alpha1
+	r.Command.SetIn(bytes.NewBufferString(`apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
 - kind: Deployment
@@ -148,7 +148,7 @@ func TestSinkCommand_Error(t *testing.T) {
 	}
 
 	r := GetSinkRunner(fake.CtxWithDefaultPrinter(), "")
-	r.Command.SetIn(bytes.NewBufferString(`apiVersion: config.kubernetes.io/v1alpha1
+	r.Command.SetIn(bytes.NewBufferString(`apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
 - kind: Deployment
@@ -186,7 +186,7 @@ func TestSinkCommandJSON(t *testing.T) {
 	os.RemoveAll(d)
 
 	r := GetSinkRunner(fake.CtxWithDefaultPrinter(), "")
-	r.Command.SetIn(bytes.NewBufferString(`apiVersion: config.kubernetes.io/v1alpha1
+	r.Command.SetIn(bytes.NewBufferString(`apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
 - {"kind": "Deployment", "metadata": {"labels": {"app": "nginx2"}, "name": "foo",
diff --git a/thirdparty/cmdconfig/commands/cmdsource/cmdsource_test.go b/thirdparty/cmdconfig/commands/cmdsource/cmdsource_test.go
index 9607885b..a517fe64 100644
--- a/thirdparty/cmdconfig/commands/cmdsource/cmdsource_test.go
+++ b/thirdparty/cmdconfig/commands/cmdsource/cmdsource_test.go
@@ -81,7 +81,7 @@ spec:
 		return
 	}
 
-	if !assert.Equal(t, `apiVersion: config.kubernetes.io/v1alpha1
+	if !assert.Equal(t, `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
 - kind: Deployment
@@ -353,7 +353,7 @@ spec:
 		return
 	}
 
-	if !assert.Equal(t, `apiVersion: config.kubernetes.io/v1alpha1
+	if !assert.Equal(t, `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
 - kind: Deployment
@@ -476,7 +476,7 @@ func TestSourceCommandJSON(t *testing.T) {
 	}
 
 	//nolint:lll
-	expected := `apiVersion: config.kubernetes.io/v1alpha1
+	expected := `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
 - {"kind": "Deployment", "metadata": {"labels": {"app": "nginx2"}, "name": "foo", "annotations": {"app": "nginx2", config.kubernetes.io/index: '0', config.kubernetes.io/path: 'f1.json', internal.config.kubernetes.io/index: '0', internal.config.kubernetes.io/path: 'f1.json', internal.config.kubernetes.io/seqindent: 'compact'}}, "spec": {"replicas": 1}}
@@ -562,7 +562,7 @@ spec:
 		return
 	}
 
-	if !assert.Equal(t, `apiVersion: config.kubernetes.io/v1alpha1
+	if !assert.Equal(t, `apiVersion: config.kubernetes.io/v1
 kind: ResourceList
 items:
 - kind: Deployment