Skip to content

Refactor Porch to remove all cloned kpt code#411

Merged
efiacor merged 30 commits intonephio-project:mainfrom
Nordix:refactor-kpt
Feb 12, 2026
Merged

Refactor Porch to remove all cloned kpt code#411
efiacor merged 30 commits intonephio-project:mainfrom
Nordix:refactor-kpt

Conversation

@liamfallon
Copy link
Member

@liamfallon liamfallon commented Jan 21, 2026

Title

Refactor Porch to remove all cloned kpt code

Description

  • What changed: This PR removes cloned code from Porch and copies a small amount of porch-only code that was in kpt across to Porch
  • Why it’s needed: There was over 20,000 lines of kpt code cloned in porch, this PR removes that code from Porch and use the kpt code instead. see EPIC: Use kptdev modules in Porch, removing duplicated code from Porch nephio#1003
  • How it works: The kpt related functionality is in kpt (dealing with kpt filles, mutation pipelines etc) and orchestration of kpt packages in PackageRevisions is in Porch.

This PR just changes imports and import labels in the code. There are no other code changes.
All code changes except for deleted files are listed with the following command:

git diff --diff-filter=d --unified=0 upstream/main 
Code changes
diff --git a/cmd/porchctl/main.go b/cmd/porchctl/main.go
index acd284cd..285b0b13 100644
--- a/cmd/porchctl/main.go
+++ b/cmd/porchctl/main.go
@@ -23,0 +24 @@ import (
+	"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
@@ -25 +25,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/cmdutil"
diff --git a/cmd/porchctl/run/run.go b/cmd/porchctl/run/run.go
index c52bdaa9..94f75e25 100644
--- a/cmd/porchctl/run/run.go
+++ b/cmd/porchctl/run/run.go
@@ -28 +28,2 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/cmdutil"
+	"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
+	"github.com/kptdev/kpt/pkg/printer"
@@ -30 +30,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/printer"
diff --git a/controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller.go b/controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller.go
index 7e09aabb..d36291d0 100644
--- a/controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller.go
+++ b/controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller.go
@@ -29,0 +30 @@ import (
+	"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
@@ -31 +31,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/kptfileutil"
diff --git a/func/internal/executableevaluator.go b/func/internal/executableevaluator.go
index c77ff7cb..267d83ad 100644
--- a/func/internal/executableevaluator.go
+++ b/func/internal/executableevaluator.go
@@ -25,0 +26 @@ import (
+	"github.com/kptdev/kpt/pkg/fn"
@@ -27 +27,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/fn"
diff --git a/func/internal/multievaluator.go b/func/internal/multievaluator.go
index e9e761ab..1966e340 100644
--- a/func/internal/multievaluator.go
+++ b/func/internal/multievaluator.go
@@ -20,0 +21 @@ import (
+	"github.com/kptdev/kpt/pkg/fn"
@@ -22 +22,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/fn"
diff --git a/go.mod b/go.mod
index 31dbea1b..38ab1b45 100644
--- a/go.mod
+++ b/go.mod
@@ -9,2 +8,0 @@ require (
-	github.com/bytecodealliance/wasmtime-go v1.0.0
-	github.com/cpuguy83/go-md2man/v2 v2.0.7
@@ -19 +16,0 @@ require (
-	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
@@ -22 +19 @@ require (
-	github.com/kptdev/kpt v1.0.0-beta.59.2
+	github.com/kptdev/kpt v1.0.0-beta.60.1
@@ -24 +20,0 @@ require (
-	github.com/kptdev/krm-functions-catalog/functions/go/apply-setters v0.2.2
@@ -28,2 +23,0 @@ require (
-	github.com/otiai10/copy v1.14.1
-	github.com/philopon/go-toposort v0.0.0-20170620085441-9be86dbd762f
@@ -31 +24,0 @@ require (
-	github.com/prep/wasmexec v0.0.0-20220807105708-6554945c1dec
@@ -43 +35,0 @@ require (
-	golang.org/x/mod v0.29.0
@@ -45 +36,0 @@ require (
-	golang.org/x/tools v0.38.0
@@ -52 +42,0 @@ require (
-	gotest.tools v2.2.0+incompatible
@@ -72,0 +63,6 @@ require (
+	github.com/bytecodealliance/wasmtime-go v1.0.0 // indirect
+	github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
+	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
+	github.com/kptdev/krm-functions-catalog/functions/go/apply-setters v0.2.2 // indirect
+	github.com/otiai10/copy v1.14.1 // indirect
+	github.com/prep/wasmexec v0.0.0-20220807105708-6554945c1dec // indirect
@@ -74,0 +71 @@ require (
+	golang.org/x/mod v0.29.0 // indirect
diff --git a/go.sum b/go.sum
index b1aaeac1..a6dfbf30 100644
--- a/go.sum
+++ b/go.sum
@@ -259,2 +259,2 @@ github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu
-github.com/kptdev/kpt v1.0.0-beta.59.2 h1:mrLxI6Qw7MUbWLx5NCIg9e6sOwt1YVM4JDhUImNZtJA=
-github.com/kptdev/kpt v1.0.0-beta.59.2/go.mod h1:jyXC9tCyw1ret0guI03X9Iyqjwyc94aG1642jz0kmq4=
+github.com/kptdev/kpt v1.0.0-beta.60.1 h1:gfgT8LNPadhFJNZ09BqcM9UoK+yMr9dxkyF1eJQmyYA=
+github.com/kptdev/kpt v1.0.0-beta.60.1/go.mod h1:LYxsFv6vMx/Q8aCxm/fw2gMJLahpMqOBtFbxhvzeHe4=
diff --git a/internal/kpt/util/porch/approval.go b/internal/cliutils/approval.go
similarity index 100%
rename from internal/kpt/util/porch/approval.go
rename to internal/cliutils/approval.go
diff --git a/internal/kpt/util/porch/client.go b/internal/cliutils/client.go
similarity index 100%
rename from internal/kpt/util/porch/client.go
rename to internal/cliutils/client.go
diff --git a/internal/kpt/util/porch/const.go b/internal/cliutils/const.go
similarity index 100%
rename from internal/kpt/util/porch/const.go
rename to internal/cliutils/const.go
diff --git a/internal/kpt/util/porch/name.go b/internal/cliutils/name.go
similarity index 100%
rename from internal/kpt/util/porch/name.go
rename to internal/cliutils/name.go
diff --git a/make/build.mk b/make/build.mk
index 9ff68589..6134f223 100644
--- a/make/build.mk
+++ b/make/build.mk
@@ -26 +26 @@ API_MODULES = \
- pkg/kpt/api \
+ internal/api \
diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go
index debb5af2..4df29efd 100644
--- a/pkg/apiserver/apiserver.go
+++ b/pkg/apiserver/apiserver.go
@@ -23,0 +24 @@ import (
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -28 +28,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
@@ -233,2 +233,2 @@ func (c completedConfig) New(ctx context.Context) (*PorchServer, error) {
-	runnerOptionsResolver := func(namespace string) fnruntime.RunnerOptions {
-		runnerOptions := fnruntime.RunnerOptions{}
+	runnerOptionsResolver := func(namespace string) runneroptions.RunnerOptions {
+		runnerOptions := runneroptions.RunnerOptions{}
diff --git a/pkg/cache/dbcache/dbpackagerevision.go b/pkg/cache/dbcache/dbpackagerevision.go
index e6e99fc4..fb72b8ad 100644
--- a/pkg/cache/dbcache/dbpackagerevision.go
+++ b/pkg/cache/dbcache/dbpackagerevision.go
@@ -25,0 +26 @@ import (
+	"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
@@ -27 +27,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/pkg"
@@ -327 +327 @@ func (pr *dbPackageRevision) GetKptfile(ctx context.Context) (kptfile.KptFile, e
-	kf, err := pkg.DecodeKptfile(strings.NewReader(kfString))
+	kf, err := kptfileutil.DecodeKptfile(strings.NewReader(kfString))
diff --git a/pkg/cli/commands/repo/get/command.go b/pkg/cli/commands/repo/get/command.go
index dcf51d97..4ea69269 100644
--- a/pkg/cli/commands/repo/get/command.go
+++ b/pkg/cli/commands/repo/get/command.go
@@ -22,2 +22,2 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/options"
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
+	cliutils "github.com/nephio-project/porch/internal/cliutils"
@@ -44 +44 @@ func newRunner(ctx context.Context, rcg *genericclioptions.ConfigFlags) *runner
-		getFlags:   options.Get{ConfigFlags: rcg},
+		getFlags:   cmdutil.Options{ConfigFlags: rcg},
@@ -55 +55 @@ func newRunner(ctx context.Context, rcg *genericclioptions.ConfigFlags) *runner
-		Hidden:  porch.HidePorchCommands,
+		Hidden:  cliutils.HidePorchCommands,
@@ -70 +70 @@ type runner struct {
-	getFlags   options.Get
+	getFlags   cmdutil.Options
diff --git a/pkg/cli/commands/repo/reg/command.go b/pkg/cli/commands/repo/reg/command.go
index c40123b0..7dee88ea 100644
--- a/pkg/cli/commands/repo/reg/command.go
+++ b/pkg/cli/commands/repo/reg/command.go
@@ -24 +24 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/repo/reg/command_test.go b/pkg/cli/commands/repo/reg/command_test.go
index a4c6ab79..5a8c82b2 100644
--- a/pkg/cli/commands/repo/reg/command_test.go
+++ b/pkg/cli/commands/repo/reg/command_test.go
@@ -29 +29 @@ import (
-	fakeprinter "github.com/nephio-project/porch/pkg/kpt/printer/fake"
+	fakeprinter "github.com/kptdev/kpt/pkg/printer/fake"
diff --git a/pkg/cli/commands/repo/repocmd.go b/pkg/cli/commands/repo/repocmd.go
index 3d92e13c..c1abe7cb 100644
--- a/pkg/cli/commands/repo/repocmd.go
+++ b/pkg/cli/commands/repo/repocmd.go
@@ -22 +22 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/repo/sync/command.go b/pkg/cli/commands/repo/sync/command.go
index 8e85896d..44e69b27 100644
--- a/pkg/cli/commands/repo/sync/command.go
+++ b/pkg/cli/commands/repo/sync/command.go
@@ -23 +23 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/options"
+	"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
@@ -25 +25 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	cliutils "github.com/nephio-project/porch/internal/cliutils"
@@ -46 +46 @@ func newRunner(ctx context.Context, rcg *genericclioptions.ConfigFlags) *runner
-		getFlags:   options.Get{ConfigFlags: rcg},
+		getFlags:   cmdutil.Options{ConfigFlags: rcg},
@@ -57 +57 @@ func newRunner(ctx context.Context, rcg *genericclioptions.ConfigFlags) *runner
-		Hidden:  porch.HidePorchCommands,
+		Hidden:  cliutils.HidePorchCommands,
@@ -73 +73 @@ type runner struct {
-	getFlags   options.Get
+	getFlags   cmdutil.Options
@@ -92 +92 @@ func (r *runner) runE(cmd *cobra.Command, args []string) error {
-		k8sClient, err = porch.CreateClientWithFlags(r.getFlags.ConfigFlags)
+		k8sClient, err = cliutils.CreateClientWithFlags(r.getFlags.ConfigFlags)
diff --git a/pkg/cli/commands/repo/sync/command_test.go b/pkg/cli/commands/repo/sync/command_test.go
index be57b2db..55967961 100644
--- a/pkg/cli/commands/repo/sync/command_test.go
+++ b/pkg/cli/commands/repo/sync/command_test.go
@@ -10 +10 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/options"
+	"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
@@ -36 +36 @@ func setupTestRunner(flags map[string]string, namespace string, client client.Cl
-		getFlags: options.Get{
+		getFlags: cmdutil.Options{
@@ -469 +469 @@ func TestRunE_ClientCreationFailure(t *testing.T) {
-		getFlags: options.Get{
+		getFlags: cmdutil.Options{
diff --git a/pkg/cli/commands/repo/unreg/command.go b/pkg/cli/commands/repo/unreg/command.go
index ab06cc0c..4edd6bf8 100644
--- a/pkg/cli/commands/repo/unreg/command.go
+++ b/pkg/cli/commands/repo/unreg/command.go
@@ -23 +23 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/approve/command.go b/pkg/cli/commands/rpkg/approve/command.go
index 735506c0..d259f898 100644
--- a/pkg/cli/commands/rpkg/approve/command.go
+++ b/pkg/cli/commands/rpkg/approve/command.go
@@ -24 +24 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/clone/command.go b/pkg/cli/commands/rpkg/clone/command.go
index a90ed946..71b1ee30 100644
--- a/pkg/cli/commands/rpkg/clone/command.go
+++ b/pkg/cli/commands/rpkg/clone/command.go
@@ -22,0 +23 @@ import (
+	"github.com/kptdev/kpt/pkg/lib/util/parse"
@@ -24,2 +25 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/parse"
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/copy/command.go b/pkg/cli/commands/rpkg/copy/command.go
index ea1a95c2..928cd29e 100644
--- a/pkg/cli/commands/rpkg/copy/command.go
+++ b/pkg/cli/commands/rpkg/copy/command.go
@@ -23 +23 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/del/command.go b/pkg/cli/commands/rpkg/del/command.go
index 1969dd92..0610bd81 100644
--- a/pkg/cli/commands/rpkg/del/command.go
+++ b/pkg/cli/commands/rpkg/del/command.go
@@ -24 +24 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/get/command.go b/pkg/cli/commands/rpkg/get/command.go
index b7cdbc36..7e24663f 100644
--- a/pkg/cli/commands/rpkg/get/command.go
+++ b/pkg/cli/commands/rpkg/get/command.go
@@ -24,2 +24,2 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/options"
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
+	porch "github.com/nephio-project/porch/internal/cliutils"
@@ -48 +48 @@ func newRunner(ctx context.Context, rcg *genericclioptions.ConfigFlags) *runner
-		getFlags:   options.Get{ConfigFlags: rcg},
+		getFlags:   cmdutil.Options{ConfigFlags: rcg},
@@ -81 +81 @@ type runner struct {
-	getFlags options.Get
+	getFlags cmdutil.Options
diff --git a/pkg/cli/commands/rpkg/init/command.go b/pkg/cli/commands/rpkg/init/command.go
index 3b942a0c..2e67e35d 100644
--- a/pkg/cli/commands/rpkg/init/command.go
+++ b/pkg/cli/commands/rpkg/init/command.go
@@ -23 +23 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/propose/command.go b/pkg/cli/commands/rpkg/propose/command.go
index ffb3217f..2fb3619e 100644
--- a/pkg/cli/commands/rpkg/propose/command.go
+++ b/pkg/cli/commands/rpkg/propose/command.go
@@ -24 +24 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/proposedelete/command.go b/pkg/cli/commands/rpkg/proposedelete/command.go
index b93dedda..89672ea6 100644
--- a/pkg/cli/commands/rpkg/proposedelete/command.go
+++ b/pkg/cli/commands/rpkg/proposedelete/command.go
@@ -24 +24 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/pull/command.go b/pkg/cli/commands/rpkg/pull/command.go
index f968c8e8..13c9741b 100644
--- a/pkg/cli/commands/rpkg/pull/command.go
+++ b/pkg/cli/commands/rpkg/pull/command.go
@@ -26,0 +27,2 @@ import (
+	"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
+	"github.com/kptdev/kpt/pkg/printer"
@@ -28,2 +30 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/cmdutil"
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
@@ -32 +32,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/printer"
diff --git a/pkg/cli/commands/rpkg/pull/command_test.go b/pkg/cli/commands/rpkg/pull/command_test.go
index 0217f1ee..d2799999 100644
--- a/pkg/cli/commands/rpkg/pull/command_test.go
+++ b/pkg/cli/commands/rpkg/pull/command_test.go
@@ -22,0 +23,2 @@ import (
+	"github.com/kptdev/kpt/pkg/printer"
+	fakeprint "github.com/kptdev/kpt/pkg/printer/fake"
@@ -24,2 +25,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/printer"
-	fakeprint "github.com/nephio-project/porch/pkg/kpt/printer/fake"
diff --git a/pkg/cli/commands/rpkg/push/command.go b/pkg/cli/commands/rpkg/push/command.go
index 2f32c203..e2e9af50 100644
--- a/pkg/cli/commands/rpkg/push/command.go
+++ b/pkg/cli/commands/rpkg/push/command.go
@@ -29,0 +30,2 @@ import (
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
+	"github.com/kptdev/kpt/pkg/printer"
@@ -31,2 +33 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
@@ -35 +35,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/printer"
@@ -184 +184,2 @@ func (r *runner) printFnResult(fnResult *porchapi.Result, opt *printer.Options)
-		ri := &fnruntime.SingleLineFormatter{
+
+		ri := &runneroptions.SingleLineFormatter{
diff --git a/pkg/cli/commands/rpkg/push/command_test.go b/pkg/cli/commands/rpkg/push/command_test.go
index 060c154b..05ebc617 100644
--- a/pkg/cli/commands/rpkg/push/command_test.go
+++ b/pkg/cli/commands/rpkg/push/command_test.go
@@ -24,0 +25,2 @@ import (
+	"github.com/kptdev/kpt/pkg/printer"
+	fakeprint "github.com/kptdev/kpt/pkg/printer/fake"
@@ -26,2 +27,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/printer"
-	fakeprint "github.com/nephio-project/porch/pkg/kpt/printer/fake"
diff --git a/pkg/cli/commands/rpkg/reject/command.go b/pkg/cli/commands/rpkg/reject/command.go
index 30d60773..d6cc82ee 100644
--- a/pkg/cli/commands/rpkg/reject/command.go
+++ b/pkg/cli/commands/rpkg/reject/command.go
@@ -24 +24 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/rpkgcmd.go b/pkg/cli/commands/rpkg/rpkgcmd.go
index b2afaa1b..eb3e7ae1 100644
--- a/pkg/cli/commands/rpkg/rpkgcmd.go
+++ b/pkg/cli/commands/rpkg/rpkgcmd.go
@@ -22 +22 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/rpkg/upgrade/command.go b/pkg/cli/commands/rpkg/upgrade/command.go
index 8ba869bf..9d662e25 100644
--- a/pkg/cli/commands/rpkg/upgrade/command.go
+++ b/pkg/cli/commands/rpkg/upgrade/command.go
@@ -25 +25 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/porch"
+	porch "github.com/nephio-project/porch/internal/cliutils"
diff --git a/pkg/cli/commands/util/factory.go b/pkg/cli/commands/util/factory.go
index 3e81d2e7..cb5110b8 100644
--- a/pkg/cli/commands/util/factory.go
+++ b/pkg/cli/commands/util/factory.go
@@ -23 +23 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/cfgflags"
+	"github.com/kptdev/kpt/pkg/lib/util/cfgflags"
diff --git a/pkg/cmd/server/start.go b/pkg/cmd/server/start.go
index 8f7a4a47..2da9c5ca 100644
--- a/pkg/cmd/server/start.go
+++ b/pkg/cmd/server/start.go
@@ -26 +26 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -351 +351 @@ func (o *PorchServerOptions) AddFlags(fs *pflag.FlagSet) {
-	fs.StringVar(&o.DefaultImagePrefix, "default-image-prefix", fnruntime.GHCRImagePrefix, "Default prefix for unqualified function names")
+	fs.StringVar(&o.DefaultImagePrefix, "default-image-prefix", runneroptions.GHCRImagePrefix, "Default prefix for unqualified function names")
diff --git a/pkg/engine/builtinruntime.go b/pkg/engine/builtinruntime.go
index b30ddbcb..32f10dcd 100644
--- a/pkg/engine/builtinruntime.go
+++ b/pkg/engine/builtinruntime.go
@@ -22,0 +23,3 @@ import (
+	"github.com/kptdev/kpt/pkg/fn"
+	"github.com/kptdev/kpt/pkg/lib/kptops"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -27,3 +29,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
-	"github.com/nephio-project/porch/pkg/kpt"
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -63,2 +63,2 @@ func newBuiltinRuntime(imagePrefix string) *builtinRuntime {
-			fnMap[fnruntime.GHCRImagePrefix+img] = fn
-			if imagePrefix != "" && imagePrefix != fnruntime.GHCRImagePrefix {
+			fnMap[runneroptions.GHCRImagePrefix+img] = fn
+			if imagePrefix != "" && imagePrefix != runneroptions.GHCRImagePrefix {
@@ -79 +79 @@ func newBuiltinRuntime(imagePrefix string) *builtinRuntime {
-var _ kpt.FunctionRuntime = &builtinRuntime{}
+var _ kptops.FunctionRuntime = &builtinRuntime{}
diff --git a/pkg/engine/builtinruntime_test.go b/pkg/engine/builtinruntime_test.go
index c93d5797..c020b3b2 100644
--- a/pkg/engine/builtinruntime_test.go
+++ b/pkg/engine/builtinruntime_test.go
@@ -23,0 +24 @@ import (
+	"github.com/kptdev/kpt/pkg/fn"
@@ -25 +25,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/fn"
diff --git a/pkg/engine/engine_test.go b/pkg/engine/engine_test.go
index 7dbd5ab3..bbabc08a 100644
--- a/pkg/engine/engine_test.go
+++ b/pkg/engine/engine_test.go
@@ -29 +29,3 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/builtins"
+	"github.com/kptdev/kpt/pkg/fn"
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -31 +32,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
@@ -33 +33,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -209 +209 @@ type mockTaskHandler struct {
-func (m *mockTaskHandler) ApplyTask(ctx context.Context, draft repository.PackageRevisionDraft, repositoryObj *configapi.Repository, obj *porchapi.PackageRevision, packageConfig *builtins.PackageConfig) error {
+func (m *mockTaskHandler) ApplyTask(ctx context.Context, draft repository.PackageRevisionDraft, repositoryObj *configapi.Repository, obj *porchapi.PackageRevision, packageConfig *builtintypes.PackageConfig) error {
@@ -241 +241 @@ func (m *mockTaskHandler) SetRepoOpener(opener repository.RepositoryOpener) {
-func (m *mockTaskHandler) SetRunnerOptionsResolver(resolver func(namespace string) fnruntime.RunnerOptions) {
+func (m *mockTaskHandler) SetRunnerOptionsResolver(resolver func(namespace string) runneroptions.RunnerOptions) {
diff --git a/pkg/engine/grpcruntime.go b/pkg/engine/grpcruntime.go
index d68bf48a..26245214 100644
--- a/pkg/engine/grpcruntime.go
+++ b/pkg/engine/grpcruntime.go
@@ -22,0 +23,2 @@ import (
+	"github.com/kptdev/kpt/pkg/fn"
+	"github.com/kptdev/kpt/pkg/lib/kptops"
@@ -24,2 +25,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt"
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -66 +66 @@ func newGRPCFunctionRuntime(options GRPCRuntimeOptions) (*grpcRuntime, error) {
-var _ kpt.FunctionRuntime = &grpcRuntime{}
+var _ kptops.FunctionRuntime = &grpcRuntime{}
diff --git a/pkg/engine/options.go b/pkg/engine/options.go
index 5aa863d2..67bd7083 100644
--- a/pkg/engine/options.go
+++ b/pkg/engine/options.go
@@ -20 +20,3 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
+	"github.com/kptdev/kpt/pkg/fn"
+	"github.com/kptdev/kpt/pkg/lib/kptops"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -22,2 +23,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt"
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -87 +87 @@ func WithSimpleFunctionRuntime() EngineOption {
-		engine.taskHandler.SetRuntime(kpt.NewSimpleFunctionRuntime())
+		engine.taskHandler.SetRuntime(kptops.NewSimpleFunctionRuntime())
@@ -92,2 +92,2 @@ func WithSimpleFunctionRuntime() EngineOption {
-func WithRunnerOptions(options fnruntime.RunnerOptions) EngineOption {
-	return WithRunnerOptionsResolver(func(namespace string) fnruntime.RunnerOptions { return options })
+func WithRunnerOptions(options runneroptions.RunnerOptions) EngineOption {
+	return WithRunnerOptionsResolver(func(namespace string) runneroptions.RunnerOptions { return options })
@@ -96 +96 @@ func WithRunnerOptions(options fnruntime.RunnerOptions) EngineOption {
-func WithRunnerOptionsResolver(fn func(namespace string) fnruntime.RunnerOptions) EngineOption {
+func WithRunnerOptionsResolver(fn func(namespace string) runneroptions.RunnerOptions) EngineOption {
diff --git a/pkg/externalrepo/git/package.go b/pkg/externalrepo/git/package.go
index 60b8ae79..bdfcba45 100644
--- a/pkg/externalrepo/git/package.go
+++ b/pkg/externalrepo/git/package.go
@@ -25,0 +26 @@ import (
+	"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
@@ -27 +27,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/pkg"
@@ -195 +195 @@ func (p *gitPackageRevision) GetKptfile(context.Context) (kptfilev1.KptFile, err
-	kf, err := pkg.DecodeKptfile(strings.NewReader(kfString))
+	kf, err := kptfileutil.DecodeKptfile(strings.NewReader(kfString))
diff --git a/pkg/externalrepo/oci/oci.go b/pkg/externalrepo/oci/oci.go
index 65152c39..e9b8c4b8 100644
--- a/pkg/externalrepo/oci/oci.go
+++ b/pkg/externalrepo/oci/oci.go
@@ -28,0 +29 @@ import (
+	"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
@@ -32 +32,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/pkg"
@@ -392 +392 @@ func (p *ociPackageRevision) GetKptfile(ctx context.Context) (kptfilev1.KptFile,
-	kf, err := pkg.DecodeKptfile(strings.NewReader(kfString))
+	kf, err := kptfileutil.DecodeKptfile(strings.NewReader(kfString))
diff --git a/pkg/repository/package.go b/pkg/repository/package.go
index ed0a572d..0b04f6de 100644
--- a/pkg/repository/package.go
+++ b/pkg/repository/package.go
@@ -21 +21 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/builtins"
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
@@ -77,2 +77,2 @@ func (p *PackageFetcher) FetchResources(ctx context.Context, packageRevisionRef
-func BuildPackageConfig(ctx context.Context, obj *porchapi.PackageRevision, parent PackageRevision) (*builtins.PackageConfig, error) {
-	config := &builtins.PackageConfig{}
+func BuildPackageConfig(ctx context.Context, obj *porchapi.PackageRevision, parent PackageRevision) (*builtintypes.PackageConfig, error) {
+	config := &builtintypes.PackageConfig{}
@@ -106 +106 @@ func BuildPackageConfig(ctx context.Context, obj *porchapi.PackageRevision, pare
-			if s := parentConfigMap.Data[builtins.ConfigKeyPackagePath]; s != "" {
+			if s := parentConfigMap.Data[builtintypes.ConfigKeyPackagePath]; s != "" {
@@ -132 +132 @@ func extractContextConfigMap(resources map[string]string) (*unstructured.Unstruc
-			if o.GetName() == builtins.PkgContextName {
+			if o.GetName() == builtintypes.PkgContextName {
@@ -142 +142 @@ func extractContextConfigMap(resources map[string]string) (*unstructured.Unstruc
-		return nil, fmt.Errorf("found multiple configmaps matching name %q", builtins.PkgContextFile)
+		return nil, fmt.Errorf("found multiple configmaps matching name %q", builtintypes.PkgContextFile)
diff --git a/pkg/repository/update.go b/pkg/repository/update.go
index 76ba0783..4f3c9943 100644
--- a/pkg/repository/update.go
+++ b/pkg/repository/update.go
@@ -24 +24,2 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/update"
+	"github.com/kptdev/kpt/pkg/lib/update"
+	updatetypes "github.com/kptdev/kpt/pkg/lib/update/updatetypes"
@@ -76,13 +76,0 @@ func (m *DefaultPackageUpdater) Update(
-func getUpdater(strategy string) update.Updater {
-	switch strategy {
-	case "fast-forward":
-		return update.FastForwardUpdater{}
-	case "force-delete-replace":
-		return update.ReplaceUpdater{}
-	case "copy-merge":
-		return update.CopyMergeUpdater{}
-	default:
-		return update.ResourceMergeUpdater{}
-	}
-}
-
@@ -97 +85 @@ func (m *DefaultPackageUpdater) do(_ context.Context, localPkgDir, originalPkgDi
-	updateOptions := update.Options{
+	updateOptions := updatetypes.Options{
@@ -104 +92 @@ func (m *DefaultPackageUpdater) do(_ context.Context, localPkgDir, originalPkgDi
-	updater := getUpdater(strategy)
+	updater := update.GetUpdater(strategy)
diff --git a/pkg/task/clone.go b/pkg/task/clone.go
index 35b66e15..96f475f0 100644
--- a/pkg/task/clone.go
+++ b/pkg/task/clone.go
@@ -23 +23,2 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/builtins"
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
+	"github.com/kptdev/kpt/pkg/lib/kptops"
@@ -28 +28,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt"
@@ -52 +52 @@ type clonePackageMutation struct {
-	packageConfig *builtins.PackageConfig
+	packageConfig *builtintypes.PackageConfig
@@ -86 +86 @@ func (m *clonePackageMutation) apply(ctx context.Context, resources repository.P
-		genPkgContextMutation, err := newPackageContextGeneratorMutation(m.packageConfig)
+		genbuiltinsMutation, err := newPackageContextGeneratorMutation(m.packageConfig)
@@ -90 +90 @@ func (m *clonePackageMutation) apply(ctx context.Context, resources repository.P
-		cloned, _, err = genPkgContextMutation.apply(ctx, cloned)
+		cloned, _, err = genbuiltinsMutation.apply(ctx, cloned)
@@ -132 +132 @@ func (m *clonePackageMutation) cloneFromRegisteredRepository(ctx context.Context
-	if err := kpt.UpdateKptfileUpstream(m.name, resources.Spec.Resources, upstream, lock); err != nil {
+	if err := kptops.UpdateKptfileUpstream(m.name, resources.Spec.Resources, upstream, lock); err != nil {
@@ -183 +183 @@ func (m *clonePackageMutation) cloneFromGit(ctx context.Context, gitPackage *por
-	if err := kpt.UpdateKptfileUpstream(m.name, contents, kptfilev1.Upstream{
+	if err := kptops.UpdateKptfileUpstream(m.name, contents, kptfilev1.Upstream{
diff --git a/pkg/task/generictaskhandler.go b/pkg/task/generictaskhandler.go
index aab45aa9..b5c7d2a8 100644
--- a/pkg/task/generictaskhandler.go
+++ b/pkg/task/generictaskhandler.go
@@ -24 +24,3 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/builtins"
+	"github.com/kptdev/kpt/pkg/fn"
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -28,2 +29,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -42 +42 @@ type genericTaskHandler struct {
-	runnerOptionsResolver      func(namespace string) fnruntime.RunnerOptions
+	runnerOptionsResolver      func(namespace string) runneroptions.RunnerOptions
@@ -54 +54 @@ func (th *genericTaskHandler) GetRuntime() fn.FunctionRuntime {
-func (th *genericTaskHandler) SetRunnerOptionsResolver(runnerOptionsResolver func(namespace string) fnruntime.RunnerOptions) {
+func (th *genericTaskHandler) SetRunnerOptionsResolver(runnerOptionsResolver func(namespace string) runneroptions.RunnerOptions) {
@@ -78 +78 @@ func (th *genericTaskHandler) SetRepoOperationRetryAttempts(retryAttempts int) {
-func (th *genericTaskHandler) ApplyTask(ctx context.Context, draft repository.PackageRevisionDraft, repositoryObj *configapi.Repository, obj *porchapi.PackageRevision, packageConfig *builtins.PackageConfig) error {
+func (th *genericTaskHandler) ApplyTask(ctx context.Context, draft repository.PackageRevisionDraft, repositoryObj *configapi.Repository, obj *porchapi.PackageRevision, packageConfig *builtintypes.PackageConfig) error {
@@ -239 +239 @@ func renderError(err error) error {
-func (th *genericTaskHandler) mapTaskToMutation(obj *porchapi.PackageRevision, task *porchapi.Task, isDeployment bool, packageConfig *builtins.PackageConfig) (mutation, error) {
+func (th *genericTaskHandler) mapTaskToMutation(obj *porchapi.PackageRevision, task *porchapi.Task, isDeployment bool, packageConfig *builtintypes.PackageConfig) (mutation, error) {
diff --git a/pkg/task/generictaskhandler_test.go b/pkg/task/generictaskhandler_test.go
index aba1357b..f40b4ad7 100644
--- a/pkg/task/generictaskhandler_test.go
+++ b/pkg/task/generictaskhandler_test.go
@@ -30,2 +30,2 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/builtins"
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -91 +91 @@ func TestApplyTasks(t *testing.T) {
-				runnerOptionsResolver: func(namespace string) fnruntime.RunnerOptions {
+				runnerOptionsResolver: func(namespace string) runneroptions.RunnerOptions {
@@ -93 +93 @@ func TestApplyTasks(t *testing.T) {
-					return fnruntime.RunnerOptions{
+					return runneroptions.RunnerOptions{
@@ -110 +110 @@ func TestApplyTasks(t *testing.T) {
-			packageConfig := &builtins.PackageConfig{}
+			packageConfig := &builtintypes.PackageConfig{}
@@ -158,3 +158,3 @@ func TestDoPrMutations(t *testing.T) {
-	ror := func(namespace string) fnruntime.RunnerOptions {
-		return fnruntime.RunnerOptions{
-			ImagePullPolicy: fnruntime.IfNotPresentPull,
+	ror := func(namespace string) runneroptions.RunnerOptions {
+		return runneroptions.RunnerOptions{
+			ImagePullPolicy: runneroptions.IfNotPresentPull,
@@ -211,3 +211,3 @@ func TestDoPrResourceMutations(t *testing.T) {
-	ror := func(namespace string) fnruntime.RunnerOptions {
-		return fnruntime.RunnerOptions{
-			ImagePullPolicy: fnruntime.IfNotPresentPull,
+	ror := func(namespace string) runneroptions.RunnerOptions {
+		return runneroptions.RunnerOptions{
+			ImagePullPolicy: runneroptions.IfNotPresentPull,
diff --git a/pkg/task/init.go b/pkg/task/init.go
index a4cc6e98..78883343 100644
--- a/pkg/task/init.go
+++ b/pkg/task/init.go
@@ -20,0 +21,3 @@ import (
+	"github.com/kptdev/kpt/pkg/kptpkg"
+	"github.com/kptdev/kpt/pkg/printer"
+	"github.com/kptdev/kpt/pkg/printer/fake"
@@ -22,3 +24,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt/kptpkg"
-	"github.com/nephio-project/porch/pkg/kpt/printer"
-	"github.com/nephio-project/porch/pkg/kpt/printer/fake"
diff --git a/pkg/task/mergekey.go b/pkg/task/mergekey.go
index 0765f842..4ad7147d 100644
--- a/pkg/task/mergekey.go
+++ b/pkg/task/mergekey.go
@@ -21 +21 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/util/addmergecomment"
+	"github.com/kptdev/kpt/pkg/lib/util/addmergecomment"
diff --git a/pkg/task/patch_test.go b/pkg/task/patch_test.go
index db463825..2342ab75 100644
--- a/pkg/task/patch_test.go
+++ b/pkg/task/patch_test.go
@@ -22,0 +23 @@ import (
+	"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
@@ -24 +24,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/pkg"
@@ -384 +384 @@ func TestKptfilePatch(t *testing.T) {
-				parsed, err := pkg.DecodeKptfile(strings.NewReader(newKfContent))
+				parsed, err := kptfileutil.DecodeKptfile(strings.NewReader(newKfContent))
diff --git a/pkg/task/builtin.go b/pkg/task/pkgctxt.go
similarity index 86%
rename from pkg/task/builtin.go
rename to pkg/task/pkgctxt.go
index 6028559b..0b6b80f4 100644
--- a/pkg/task/builtin.go
+++ b/pkg/task/pkgctxt.go
@@ -20,0 +21 @@ import (
+	"github.com/kptdev/kpt/pkg/fn"
@@ -21,0 +23,2 @@ import (
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -23,2 +25,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -37,4 +38,2 @@ type builtinEvalMutation struct {
-func newPackageContextGeneratorMutation(packageConfig *builtins.PackageConfig) (mutation, error) {
-	runner := &builtins.PackageContextGenerator{
-		PackageConfig: packageConfig,
-	}
+func newPackageContextGeneratorMutation(packageConfig *builtintypes.PackageConfig) (mutation, error) {
+	runner := builtins.GetBuiltinFn(packageConfig)
@@ -43 +42 @@ func newPackageContextGeneratorMutation(packageConfig *builtins.PackageConfig) (
-		function: fnruntime.FuncGenPkgContext,
+		function: runneroptions.FuncGenPkgContext,
diff --git a/pkg/task/builtin_test.go b/pkg/task/pkgctxt_test.go
similarity index 94%
rename from pkg/task/builtin_test.go
rename to pkg/task/pkgctxt_test.go
index 3ad6d4b7..63db8849 100644
--- a/pkg/task/builtin_test.go
+++ b/pkg/task/pkgctxt_test.go
@@ -24 +24 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/builtins"
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
@@ -40 +40 @@ func TestPackageContext(t *testing.T) {
-	packageConfig := &builtins.PackageConfig{
+	packageConfig := &builtintypes.PackageConfig{
diff --git a/pkg/task/render.go b/pkg/task/render.go
index 6938a1fe..2a1032d0 100644
--- a/pkg/task/render.go
+++ b/pkg/task/render.go
@@ -24,0 +25,3 @@ import (
+	"github.com/kptdev/kpt/pkg/fn"
+	"github.com/kptdev/kpt/pkg/lib/kptops"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -26,3 +28,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
-	"github.com/nephio-project/porch/pkg/kpt"
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -37 +37 @@ type renderPackageMutation struct {
-	runnerOptions fnruntime.RunnerOptions
+	runnerOptions runneroptions.RunnerOptions
@@ -60 +60 @@ func (m *renderPackageMutation) apply(ctx context.Context, resources repository.
-		renderer := kpt.NewRenderer(m.runnerOptions)
+		renderer := kptops.NewRenderer(m.runnerOptions)
diff --git a/pkg/task/render_test.go b/pkg/task/render_test.go
index b17d3f51..8cc9b465 100644
--- a/pkg/task/render_test.go
+++ b/pkg/task/render_test.go
@@ -25,2 +25,2 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
-	"github.com/nephio-project/porch/pkg/kpt"
+	"github.com/kptdev/kpt/pkg/lib/kptops"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -33,2 +33,2 @@ func TestRender(t *testing.T) {
-	runnerOptions := fnruntime.RunnerOptions{}
-	runnerOptions.InitDefaults(fnruntime.GHCRImagePrefix)
+	runnerOptions := runneroptions.RunnerOptions{}
+	runnerOptions.InitDefaults(runneroptions.GHCRImagePrefix)
@@ -38 +38 @@ func TestRender(t *testing.T) {
-		runtime:       kpt.NewSimpleFunctionRuntime(),
+		runtime:       kptops.NewSimpleFunctionRuntime(),
diff --git a/pkg/task/taskhandler.go b/pkg/task/taskhandler.go
index 9024b24c..f17f78a0 100644
--- a/pkg/task/taskhandler.go
+++ b/pkg/task/taskhandler.go
@@ -20 +20,3 @@ import (
-	"github.com/kptdev/kpt/pkg/lib/builtins"
+	"github.com/kptdev/kpt/pkg/fn"
+	"github.com/kptdev/kpt/pkg/lib/builtins/builtintypes"
+	"github.com/kptdev/kpt/pkg/lib/runneroptions"
@@ -23,2 +24,0 @@ import (
-	"github.com/nephio-project/porch/internal/kpt/fnruntime"
-	"github.com/nephio-project/porch/pkg/kpt/fn"
@@ -34 +34 @@ type TaskHandler interface {
-	SetRunnerOptionsResolver(func(namespace string) fnruntime.RunnerOptions)
+	SetRunnerOptionsResolver(func(namespace string) runneroptions.RunnerOptions)
@@ -41 +41 @@ type TaskHandler interface {
-	ApplyTask(ctx context.Context, draft repository.PackageRevisionDraft, repositoryObj *configapi.Repository, obj *porchapi.PackageRevision, packageConfig *builtins.PackageConfig) error
+	ApplyTask(ctx context.Context, draft repository.PackageRevisionDraft, repositoryObj *configapi.Repository, obj *porchapi.PackageRevision, packageConfig *builtintypes.PackageConfig) error
diff --git a/pkg/task/testdata/simple-render/expected.txt b/pkg/task/testdata/simple-render/expected.txt
index f625b40c..d057297c 100644
--- a/pkg/task/testdata/simple-render/expected.txt
+++ b/pkg/task/testdata/simple-render/expected.txt
@@ -22 +22 @@ metadata: # kpt-merge: config-control/blueprints-project-bucket
-    cnrm.cloud.google.com/blueprint: 'kpt-fn'
+    cnrm.cloud.google.com/blueprint: 'krm-fn'
diff --git a/pkg/task/upgrade.go b/pkg/task/upgrade.go
index 74e385b3..8248041b 100644
--- a/pkg/task/upgrade.go
+++ b/pkg/task/upgrade.go
@@ -19,0 +20 @@ import (
+	"github.com/kptdev/kpt/pkg/lib/kptops"
@@ -21 +21,0 @@ import (
-	"github.com/nephio-project/porch/pkg/kpt"
@@ -94 +94 @@ func (m *upgradePackageMutation) apply(ctx context.Context, _ repository.Package
-	if err := kpt.UpdateKptfileUpstream("", updatedResources.Contents, newUpstream, newUpstreamLock); err != nil {
+	if err := kptops.UpdateKptfileUpstream("", updatedResources.Contents, newUpstream, newUpstreamLock); err != nil {
diff --git a/test/e2e/suiteutils/suite.go b/test/e2e/suiteutils/suite.go
index 8a8b373e..6688c57b 100644
--- a/test/e2e/suiteutils/suite.go
+++ b/test/e2e/suiteutils/suite.go
@@ -28,0 +29 @@ import (
+	"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
@@ -33 +33,0 @@ import (
-	internalpkg "github.com/nephio-project/porch/internal/kpt/pkg"
@@ -476 +476 @@ func (t *TestSuite) ParseKptfileF(resources *porchapi.PackageRevisionResources)
-	kptfile, err := internalpkg.DecodeKptfile(strings.NewReader(contents))
+	kptfile, err := kptfileutil.DecodeKptfile(strings.NewReader(contents))

The cloned kpt code deleted in this PR is listed with the following command:

git diff --name-only --diff-filter=D  upstream/main
Deleted files
internal/kpt/cmdutil/util.go
internal/kpt/fnruntime/container.go
internal/kpt/fnruntime/container_test.go
internal/kpt/fnruntime/exec.go
internal/kpt/fnruntime/fnerrors.go
internal/kpt/fnruntime/fnerrors_test.go
internal/kpt/fnruntime/imagepullpolicy.go
internal/kpt/fnruntime/jsglue.go
internal/kpt/fnruntime/nodejs.go
internal/kpt/fnruntime/runner.go
internal/kpt/fnruntime/runner_test.go
internal/kpt/fnruntime/utils.go
internal/kpt/fnruntime/utils_test.go
internal/kpt/fnruntime/wasm.go
internal/kpt/fnruntime/wasmtime.go
internal/kpt/fnruntime/wasmtime_unsupported.go
internal/kpt/gitutil/errors.go
internal/kpt/gitutil/gitutil.go
internal/kpt/gitutil/gitutil_test.go
internal/kpt/hook/executor.go
internal/kpt/pkg/pkg.go
internal/kpt/pkg/pkg_test.go
internal/kpt/pkg/testing/helpers.go
internal/kpt/testutil/pkgbuilder/builder.go
internal/kpt/testutil/pkgbuilder/builder_test.go
internal/kpt/testutil/pkgbuilder/fns.go
internal/kpt/testutil/setup_manager.go
internal/kpt/testutil/testdata/dataset1/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset1/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/dataset1/java/java-service.resource.yaml
internal/kpt/testutil/testdata/dataset1/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset1/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/dataset1/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset1/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/dataset1/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset2/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset2/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/dataset2/java/java-service.resource.yaml
internal/kpt/testutil/testdata/dataset2/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset2/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/dataset2/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset2/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/dataset2/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset3/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset3/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/dataset3/java/java-service.resource.yaml
internal/kpt/testutil/testdata/dataset3/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset3/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/dataset3/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset3/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/dataset3/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset4/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset4/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/dataset4/java/java-service.resource.yaml
internal/kpt/testutil/testdata/dataset4/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset4/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/dataset4/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset4/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/dataset4/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset5/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset5/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/dataset5/java/java-service.resource.yaml
internal/kpt/testutil/testdata/dataset5/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset5/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/dataset5/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset5/somefunction.py
internal/kpt/testutil/testdata/dataset5/wordpress/wordpress-description.txt
internal/kpt/testutil/testdata/dataset5/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/dataset5/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset5/wordpress/wordpress-subdir/wordpress-subdir-description.txt
internal/kpt/testutil/testdata/dataset6/java/config-symlink
internal/kpt/testutil/testdata/dataset6/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset6/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/dataset6/java/java-service.resource.yaml
internal/kpt/testutil/testdata/dataset6/mysql-symlink
internal/kpt/testutil/testdata/dataset6/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/dataset6/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/dataset6/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset6/somefunction.py
internal/kpt/testutil/testdata/dataset6/wordpress/wordpress-description.txt
internal/kpt/testutil/testdata/dataset6/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/dataset6/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testdata/dataset6/wordpress/wordpress-subdir/wordpress-subdir-description.txt
internal/kpt/testutil/testdata/datasetmerged/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/datasetmerged/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/datasetmerged/java/java-service.resource.yaml
internal/kpt/testutil/testdata/datasetmerged/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/datasetmerged/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/datasetmerged/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/datasetmerged/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/datasetmerged/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/Kptfile
internal/kpt/testutil/testdata/updateMergeConflict/java/java-configmap.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/java/java-deployment.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/java/java-service.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/mysql/mysql-configmap.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/mysql/mysql-service.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/mysql/mysql-statefulset.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/wordpress/wordpress-service.resource.yaml
internal/kpt/testutil/testdata/updateMergeConflict/wordpress/wordpress-statefulset.resource.yaml
internal/kpt/testutil/testutil.go
internal/kpt/util/addmergecomment/addmergecomment.go
internal/kpt/util/addmergecomment/addmergecomment_test.go
internal/kpt/util/argutil/argutil.go
internal/kpt/util/argutil/argutil_test.go
internal/kpt/util/attribution/attribution.go
internal/kpt/util/attribution/attribution_test.go
internal/kpt/util/cfgflags/useragent.go
internal/kpt/util/cfgflags/useragent_test.go
internal/kpt/util/cmdutil/cmdutil.go
internal/kpt/util/cmdutil/cmdutil_test.go
internal/kpt/util/diff/diff.go
internal/kpt/util/diff/diff_test.go
internal/kpt/util/diff/pkgdiff.go
internal/kpt/util/diff/pkgdiff_test.go
internal/kpt/util/fetch/fetch.go
internal/kpt/util/fetch/fetch_test.go
internal/kpt/util/get/example_test.go
internal/kpt/util/get/get.go
internal/kpt/util/get/get_test.go
internal/kpt/util/git/git.go
internal/kpt/util/httputil/httputil.go
internal/kpt/util/man/man.go
internal/kpt/util/man/man_test.go
internal/kpt/util/merge/merge3.go
internal/kpt/util/parse/parse.go
internal/kpt/util/parse/parse_test.go
internal/kpt/util/pathutil/pathutil.go
internal/kpt/util/pkgutil/pkgutil.go
internal/kpt/util/pkgutil/pkgutil_test.go
internal/kpt/util/porch/doc.go
internal/kpt/util/printerutil/printerutil.go
internal/kpt/util/render/executor.go
internal/kpt/util/render/executor_test.go
internal/kpt/util/stack/stack.go
internal/kpt/util/strings/strings.go
internal/kpt/util/strings/strings_test.go
internal/kpt/util/update/common.go
internal/kpt/util/update/copy-merge.go
internal/kpt/util/update/copy-merge_test.go
internal/kpt/util/update/fastforward.go
internal/kpt/util/update/fastforward_test.go
internal/kpt/util/update/replace.go
internal/kpt/util/update/replace_test.go
internal/kpt/util/update/resource-merge.go
internal/kpt/util/update/resource-merge_test.go
internal/kpt/util/update/update.go
internal/kpt/util/update/update_test.go
internal/tools/tools.go
pkg/kpt/clone.go
pkg/kpt/clone_test.go
pkg/kpt/eval.go
pkg/kpt/eval_test.go
pkg/kpt/fn/eval.go
pkg/kpt/fn/eval_test.go
pkg/kpt/fn/multiruntime.go
pkg/kpt/fn/render.go
pkg/kpt/fnruntime.go
pkg/kpt/fs_test.go
pkg/kpt/internal/apply-setters.go
pkg/kpt/internal/doc.go
pkg/kpt/internal/functions.go
pkg/kpt/internal/set-labels.go
pkg/kpt/internal/set-namespace.go
pkg/kpt/kptfileutil/util.go
pkg/kpt/kptfileutil/util_test.go
pkg/kpt/kptpkg/init.go
pkg/kpt/pkgupdate.go
pkg/kpt/printer/fake/fake.go
pkg/kpt/printer/printer.go
pkg/kpt/printer/printer_test.go
pkg/kpt/render.go
pkg/kpt/render_test.go
pkg/kpt/testdata/bucket/bucket.yaml
pkg/kpt/testdata/render-with-function-config/expected.txt
pkg/kpt/testdata/render-with-function-config/simple-bucket/Kptfile
pkg/kpt/testdata/render-with-function-config/simple-bucket/bucket.yaml
pkg/kpt/testdata/render-with-function-config/simple-bucket/setters.yaml
pkg/kpt/testdata/render-with-inline-config/expected.txt
pkg/kpt/testdata/render-with-inline-config/simple-bucket/Kptfile
pkg/kpt/testdata/render-with-inline-config/simple-bucket/bucket.yaml
pkg/util/merge3/merge3.go
pkg/util/merge3/merge3_test.go
pkg/util/merge3/merge3_util_test.go
pkg/util/merge3/resource_matcher.go
pkg/util/merge3/schema.go
pkg/util/merge3/strategy.go
pkg/util/merge3/strategy_test.go
pkg/util/merge3/testdata/infer-crd-empty-dest/destination.yaml
pkg/util/merge3/testdata/infer-crd-empty-dest/original.yaml
pkg/util/merge3/testdata/infer-crd-empty-dest/updated.yaml
pkg/util/merge3/testdata/infer-crd-empty-orig/destination.yaml
pkg/util/merge3/testdata/infer-crd-empty-orig/original.yaml
pkg/util/merge3/testdata/infer-crd-empty-orig/updated.yaml
pkg/util/merge3/testdata/infer-crd-empty-updated/destination.yaml
pkg/util/merge3/testdata/infer-crd-empty-updated/original.yaml
pkg/util/merge3/testdata/infer-crd-empty-updated/updated.yaml
pkg/util/merge3/testdata/infer-crd/destination.yaml
pkg/util/merge3/testdata/infer-crd/original.yaml
pkg/util/merge3/testdata/infer-crd/updated.yaml
pkg/util/merge3/testdata/one-key-crd-empty-dest/destination.yaml
pkg/util/merge3/testdata/one-key-crd-empty-dest/fruitstore.crd.yaml
pkg/util/merge3/testdata/one-key-crd-empty-dest/original.yaml
pkg/util/merge3/testdata/one-key-crd-empty-dest/updated.yaml
pkg/util/merge3/testdata/one-key-crd-empty-orig/destination.yaml
pkg/util/merge3/testdata/one-key-crd-empty-orig/fruitstore.crd.yaml
pkg/util/merge3/testdata/one-key-crd-empty-orig/original.yaml
pkg/util/merge3/testdata/one-key-crd-empty-orig/updated.yaml
pkg/util/merge3/testdata/one-key-crd-empty-updated/destination.yaml
pkg/util/merge3/testdata/one-key-crd-empty-updated/fruitstore.crd.yaml
pkg/util/merge3/testdata/one-key-crd-empty-updated/original.yaml
pkg/util/merge3/testdata/one-key-crd-empty-updated/updated.yaml
pkg/util/merge3/testdata/one-key-crd/destination.yaml
pkg/util/merge3/testdata/one-key-crd/fruitstore.crd.yaml
pkg/util/merge3/testdata/one-key-crd/original.yaml
pkg/util/merge3/testdata/one-key-crd/updated.yaml
pkg/util/merge3/testdata/simple-conflict/destination.yaml
pkg/util/merge3/testdata/simple-conflict/original.yaml
pkg/util/merge3/testdata/simple-conflict/updated.yaml
pkg/util/merge3/testdata/simple-subpackage-conflict/destination.yaml
pkg/util/merge3/testdata/simple-subpackage-conflict/original.yaml
pkg/util/merge3/testdata/simple-subpackage-conflict/updated.yaml
pkg/util/merge3/tuple.go


Related Issue(s)

The twin PR in kpt is merged, see kptdev/kpt#4355.


Type of Change

  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Documentation
  • Tests
  • Other: ________

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • [N/A] Documentation added/updated
  • [] All tests and gating checks pass

## See also:
kptdev/kpt#4271

@netlify
Copy link

netlify bot commented Jan 21, 2026

Deploy Preview for porch ready!

Name Link
🔨 Latest commit d667fa6
🔍 Latest deploy log https://app.netlify.com/projects/porch/deploys/698e112c46bb8b00099b81e5
😎 Deploy Preview https://deploy-preview-411--porch.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@kushnaidu kushnaidu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo in the folder name - internal/clliutils should be cliutils

@liamfallon
Copy link
Member Author

small typo in the folder name - internal/clliutils should be cliutils

Well spotted, Fixed!

…functions

Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
…functions

Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
…functions

Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
30.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@efiacor efiacor merged commit 1e20a1a into nephio-project:main Feb 12, 2026
22 checks passed
@efiacor efiacor deleted the refactor-kpt branch February 12, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants