Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ test-fn-eval: build
test-live-apply: build
PATH="$(GOBIN):$(PATH)" go test -v -timeout=20m --tags=kind -p 2 --run=TestLiveApply/testdata/live-apply/$(T) ./e2e/

# target to run e2e tests for "kpt live plan" command
test-live-plan: build
PATH="$(GOBIN):$(PATH)" go test -v -timeout=20m --tags=kind -p 2 --run=TestLivePlan/testdata/live-plan/$(T) ./e2e/

vet:
go vet ./...

Expand Down
2 changes: 0 additions & 2 deletions commands/alpha/alphacmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/kptdev/kpt/commands/alpha/wasm"

"github.com/kptdev/kpt/internal/docs/generated/alphadocs"
"github.com/kptdev/kpt/internal/util/porch"
"github.com/spf13/cobra"
)

Expand All @@ -41,7 +40,6 @@ func GetCommand(ctx context.Context, _, version string) *cobra.Command {
}
return cmd.Usage()
},
Hidden: porch.HidePorchCommands,
}

alpha.AddCommand(
Expand Down
10 changes: 4 additions & 6 deletions commands/fn/doc/cmdfndoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
"os/exec"

"github.com/kptdev/kpt/internal/docs/generated/fndocs"
"github.com/kptdev/kpt/internal/util/cmdutil"
"github.com/kptdev/kpt/pkg/lib/fnruntime"
"github.com/kptdev/kpt/internal/fnruntime"
"github.com/kptdev/kpt/pkg/lib/runneroptions"
"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
"github.com/kptdev/kpt/pkg/printer"
"github.com/spf13/cobra"
)
Expand All @@ -43,9 +44,6 @@ func NewRunner(ctx context.Context, parent string) *Runner {
}
r.Command = c
c.Flags().StringVarP(&r.Image, "image", "i", "", "kpt function image name")
_ = r.Command.RegisterFlagCompletionFunc("image", func(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return cmdutil.SuggestFunctions(cmd), cobra.ShellCompDirectiveDefault
})
cmdutil.FixDocs("kpt", parent, c)
return r
}
Expand All @@ -64,7 +62,7 @@ func (r *Runner) runE(c *cobra.Command, _ []string) error {
if r.Image == "" {
return errors.New("image must be specified")
}
resolveFunc := fnruntime.ResolveToImageForCLIFunc(fnruntime.GHCRImagePrefix)
resolveFunc := (&runneroptions.RunnerOptions{}).ResolveToImageForCLIFunc(runneroptions.GHCRImagePrefix)
image, err := resolveFunc(c.Context(), r.Image)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions commands/fn/render/cmdrender.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (

docs "github.com/kptdev/kpt/internal/docs/generated/fndocs"
"github.com/kptdev/kpt/internal/util/argutil"
"github.com/kptdev/kpt/internal/util/cmdutil"
"github.com/kptdev/kpt/internal/util/pathutil"
"github.com/kptdev/kpt/internal/util/render"
"github.com/kptdev/kpt/pkg/lib/fnruntime"
"github.com/kptdev/kpt/pkg/lib/runneroptions"
"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
"github.com/kptdev/kpt/pkg/printer"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
Expand Down Expand Up @@ -80,11 +80,11 @@ type Runner struct {
Command *cobra.Command
ctx context.Context

RunnerOptions fnruntime.RunnerOptions
RunnerOptions runneroptions.RunnerOptions
}

func (r *Runner) InitDefaults() {
r.RunnerOptions.InitDefaults(fnruntime.GHCRImagePrefix)
r.RunnerOptions.InitDefaults(runneroptions.GHCRImagePrefix)
}

func (r *Runner) preRunE(_ *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion commands/live/apply/cmdapply.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/kptdev/kpt/internal/docs/generated/livedocs"
"github.com/kptdev/kpt/internal/util/argutil"
"github.com/kptdev/kpt/internal/util/strings"
"github.com/kptdev/kpt/pkg/lib/cmdutil"
"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
"github.com/kptdev/kpt/pkg/live"
"github.com/kptdev/kpt/pkg/status"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion commands/live/init/cmdliveinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import (

"github.com/kptdev/kpt/internal/docs/generated/livedocs"
"github.com/kptdev/kpt/internal/pkg"
"github.com/kptdev/kpt/internal/types"
"github.com/kptdev/kpt/internal/util/attribution"
"github.com/kptdev/kpt/internal/util/pathutil"
kptfilev1 "github.com/kptdev/kpt/pkg/api/kptfile/v1"
rgfilev1alpha1 "github.com/kptdev/kpt/pkg/api/resourcegroup/v1alpha1"
"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
"github.com/kptdev/kpt/pkg/lib/errors"
"github.com/kptdev/kpt/pkg/lib/types"
"github.com/kptdev/kpt/pkg/printer"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
Expand Down
2 changes: 1 addition & 1 deletion commands/live/migrate/migratecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import (
initialization "github.com/kptdev/kpt/commands/live/init"
"github.com/kptdev/kpt/internal/docs/generated/livedocs"
"github.com/kptdev/kpt/internal/pkg"
"github.com/kptdev/kpt/internal/types"
"github.com/kptdev/kpt/internal/util/argutil"
"github.com/kptdev/kpt/internal/util/pathutil"
rgfilev1alpha1 "github.com/kptdev/kpt/pkg/api/resourcegroup/v1alpha1"
"github.com/kptdev/kpt/pkg/kptfile/kptfileutil"
"github.com/kptdev/kpt/pkg/lib/errors"
"github.com/kptdev/kpt/pkg/lib/types"
"github.com/kptdev/kpt/pkg/live"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down
2 changes: 1 addition & 1 deletion commands/pkg/diff/cmddiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"github.com/kptdev/kpt/internal/docs/generated/pkgdocs"
"github.com/kptdev/kpt/internal/pkg"
"github.com/kptdev/kpt/internal/util/argutil"
"github.com/kptdev/kpt/internal/util/cmdutil"
"github.com/kptdev/kpt/internal/util/diff"
"github.com/kptdev/kpt/internal/util/pathutil"
"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
"github.com/kptdev/kpt/pkg/printer"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
Expand Down
6 changes: 3 additions & 3 deletions commands/pkg/get/cmdget.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (

docs "github.com/kptdev/kpt/internal/docs/generated/pkgdocs"
"github.com/kptdev/kpt/internal/pkg"
"github.com/kptdev/kpt/internal/types"
"github.com/kptdev/kpt/internal/util/argutil"
"github.com/kptdev/kpt/internal/util/cmdutil"
"github.com/kptdev/kpt/internal/util/get"
"github.com/kptdev/kpt/internal/util/parse"
"github.com/kptdev/kpt/internal/util/pathutil"
kptfilev1 "github.com/kptdev/kpt/pkg/api/kptfile/v1"
"github.com/kptdev/kpt/pkg/lib/errors"
"github.com/kptdev/kpt/pkg/lib/types"
"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
"github.com/kptdev/kpt/pkg/lib/util/parse"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
)
Expand Down
2 changes: 1 addition & 1 deletion commands/pkg/init/cmdinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (

docs "github.com/kptdev/kpt/internal/docs/generated/pkgdocs"
"github.com/kptdev/kpt/internal/pkg"
"github.com/kptdev/kpt/internal/util/cmdutil"
"github.com/kptdev/kpt/internal/util/pathutil"
"github.com/kptdev/kpt/pkg/kptpkg"
"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
)
Expand Down
5 changes: 3 additions & 2 deletions commands/pkg/init/cmdinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"testing"

initialization "github.com/kptdev/kpt/commands/pkg/init"
"github.com/kptdev/kpt/internal/builtins"
"github.com/kptdev/kpt/internal/testutil"
"github.com/kptdev/kpt/internal/util/man"
"github.com/kptdev/kpt/pkg/lib/builtins"
"github.com/kptdev/kpt/pkg/lib/pkgcontext/pkgcontexttypes"
"github.com/kptdev/kpt/pkg/printer/fake"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -80,7 +81,7 @@ kpt live apply my-pkg --reconcile-timeout=2m --output=table
Details: https://kpt.dev/reference/cli/live/
`, "'", "`"), string(b))

b, err = os.ReadFile(filepath.Join(d, "my-pkg", builtins.PkgContextFile))
b, err = os.ReadFile(filepath.Join(d, "my-pkg", pkgcontexttypes.PkgContextFile))
assert.NoError(t, err)
assert.Equal(t, b, []byte(builtins.AbstractPkgContext()))
}
Expand Down
4 changes: 2 additions & 2 deletions commands/pkg/update/cmdupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (

docs "github.com/kptdev/kpt/internal/docs/generated/pkgdocs"
"github.com/kptdev/kpt/internal/pkg"
"github.com/kptdev/kpt/internal/types"
"github.com/kptdev/kpt/internal/util/argutil"
"github.com/kptdev/kpt/internal/util/cmdutil"
"github.com/kptdev/kpt/internal/util/pathutil"
"github.com/kptdev/kpt/internal/util/update"
kptfilev1 "github.com/kptdev/kpt/pkg/api/kptfile/v1"
"github.com/kptdev/kpt/pkg/lib/errors"
"github.com/kptdev/kpt/pkg/lib/types"
"github.com/kptdev/kpt/pkg/lib/util/cmdutil"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
)
Expand Down
2 changes: 1 addition & 1 deletion commands/pkg/update/cmdupdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (

"github.com/kptdev/kpt/commands/pkg/get"
"github.com/kptdev/kpt/commands/pkg/update"
"github.com/kptdev/kpt/internal/gitutil"
"github.com/kptdev/kpt/internal/testutil"
"github.com/kptdev/kpt/internal/testutil/pkgbuilder"
kptfilev1 "github.com/kptdev/kpt/pkg/api/kptfile/v1"
"github.com/kptdev/kpt/pkg/lib/gitutil"
"github.com/kptdev/kpt/pkg/printer/fake"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion commands/util/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"time"

"github.com/kptdev/kpt/internal/util/cfgflags"
"github.com/kptdev/kpt/pkg/lib/util/cfgflags"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/rest"
Expand Down
2 changes: 1 addition & 1 deletion e2e/fn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"strings"
"testing"

"github.com/kptdev/kpt/pkg/lib/fnruntime"
"github.com/kptdev/kpt/internal/fnruntime"
"github.com/kptdev/kpt/pkg/test/runner"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ stdErr: |-
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" in 0s

Successfully executed 2 function(s) in 1 package(s).
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ stdErr: |
Package: "exec-function-stderr"
[RUNNING] "./testdata/fn-render/exec-function-stderr/function.sh"
[PASS] "./testdata/fn-render/exec-function-stderr/function.sh" in 0s
Stderr: Hello world 0!, Hello world 1!, Hello world 2!, Hello world 3!, Hello world 4!, Hello world 5!, Hello world 6!, Hello world 7!, Hello world 8!, Hello world 9!, Hello world 10!, Hello world 11!, Hello world 12!, Hello world 13!, Hello world 14!, Hello world 15!, Hello world 16!, Hello world 17!, Hello world 18!, Hello world 19!, Hello world 20!,
Successfully executed 1 function(s) in 1 package(s).
Stderr: Hello world 0!, Hello world 1!, Hello world 2!, Hello world 3!, Hello world 4!, Hello world 5!, Hello world 6!, Hello world 7!, Hello world 8!, Hello world 9!, Hello world 10!, Hello world 11!, Hello world 12!, Hello world 13!, Hello world 14!, Hello world 15!, Hello world 16!, Hello world 17!, Hello world 18!, Hello world 19!, Hello world 20!, Successfully executed 1 function(s) in 1 package(s).
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,3 @@ stdOut: |
stdErr: |
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s

For complete results, see
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ stdErr: |
Package: "out-of-place-fnchain-stdout"
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s

[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-annotations:latest"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-annotations:latest" in 0s
[Results]: [info] metadata.annotations: set annotations: {"foo":"bar"}, [info] metadata.annotations: set annotations: {"foo":"bar"}, [info] spec.template.metadata.annotations: set annotations: {"foo":"bar"}, [info] metadata.annotations: set annotations: {"foo":"bar"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ stdErr: |
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" in 0s

Successfully executed 2 function(s) in 1 package(s).

Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ stdErr: |
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" on 2 resource(s)
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" in 0s

Successfully executed 2 function(s) in 1 package(s).
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ stdErr: |
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" on 1 resource(s)
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" in 0s

Package: "generator"
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" on 1 resource(s)
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" on 1 resource(s)
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" in 0s

Successfully executed 5 function(s) in 2 package(s).
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ stdErr: |
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" in 0s

Successfully executed 2 function(s) in 1 package(s).
Loading
Loading