Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Porch into main branch #2815

Merged
merged 90 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
f00cc03
Simple package orchestration (#2663)
martinmaly Jan 25, 2022
9f7687f
oci-support feature branch (#2666)
loudej Jan 26, 2022
b5de73f
Remove Placeholder kptlib (#2665)
martinmaly Jan 26, 2022
2a3d1da
Fix Porch Build (#2672)
martinmaly Jan 27, 2022
a747137
Correct Apache License Text (#2675)
martinmaly Jan 27, 2022
1512349
Implement Direct Package Fetch (#2667)
martinmaly Jan 27, 2022
66adf78
Initial fn Interface (#2676)
martinmaly Jan 27, 2022
81260a4
Upgrade go-containerregistry to v0.8.0 (#2674)
martinmaly Jan 27, 2022
1d5d77a
git: handle resolution of per-package versions (#2681)
justinsb Jan 28, 2022
b10084c
PackageDraft interface should not inherit from Package (#2678)
justinsb Jan 28, 2022
3878005
Minor fixups to better surface errors (#2680)
justinsb Jan 28, 2022
437bd07
Clean up Makefile (#2685)
martinmaly Jan 28, 2022
d33d90f
Render and Eval via Simple Memory FS (#2684)
martinmaly Jan 28, 2022
d420794
Working towards applying packages from a repository (#2686)
justinsb Jan 31, 2022
4da503c
Add priority and fairness to RBAC roles (#2692)
justinsb Jan 31, 2022
f1e7c9f
Applying: publish MVP status (#2695)
justinsb Jan 31, 2022
f8cb5f7
Fix Docker Build (#2696)
martinmaly Jan 31, 2022
7f4fd85
Tidy Go Modules (#2699)
martinmaly Jan 31, 2022
7672d2f
Add Roundtrip Tests (#2703)
martinmaly Jan 31, 2022
30a99b1
Expose Renderer api with FileSystem abstraction (#2683)
phanimarupaka Jan 31, 2022
63f13ab
Create fix-all and verify-fix-all (#2702)
justinsb Feb 1, 2022
2f25f7f
Fix few file headers (#2707)
martinmaly Feb 1, 2022
3fa3838
Define a FunctionEvaluator gRPC Interface (#2700)
martinmaly Feb 1, 2022
7dde871
Integrate porch with renderer interface (#2710)
phanimarupaka Feb 2, 2022
111cd99
Introduce applyset abstraction (#2697)
justinsb Feb 2, 2022
dfed272
Git repository test (#2706)
justinsb Feb 2, 2022
432de49
Create Kptfile in config/deploy (#2708)
justinsb Feb 2, 2022
b1bcae5
Update FunctionRunner Interface (#2714)
martinmaly Feb 2, 2022
9ae4925
Simple gRPC kpt function runner service (#2711)
martinmaly Feb 2, 2022
74f4ee9
Merge main branch into porch.
martinmaly Feb 2, 2022
ee978c4
Use simple evaluator in tests (#2717)
martinmaly Feb 2, 2022
c4cedb0
Fix os calls (#2718)
phanimarupaka Feb 3, 2022
97f3e8c
git: create ApprovePackageRevision method, remove draft hack (#2712)
justinsb Feb 3, 2022
dd40ec8
Kpt location parsing (#2688)
loudej Feb 3, 2022
08059cf
Use apply-setters directly (#2719)
martinmaly Feb 3, 2022
82ac181
Upgrade kpt dependencies (#2727)
martinmaly Feb 4, 2022
7f63fd1
Use Lower-Level Function Runner Interface (#2730)
martinmaly Feb 4, 2022
51205e4
Use kyaml In-Memory Filesystem (#2731)
martinmaly Feb 4, 2022
bdb7ae7
Upgrade porch dependencies (#2726)
martinmaly Feb 4, 2022
ccf2449
Build Function Runner Docker Image (#2729)
martinmaly Feb 4, 2022
4ef60a7
tests: Fix test flake from timestamp sanitization (#2713) (#2742)
martinmaly Feb 4, 2022
8f6e79f
Create function-runner Deployment (#2733)
martinmaly Feb 4, 2022
d9bc219
Use kpt Renderer in Porch (#2735)
martinmaly Feb 4, 2022
92905c2
RemoteRootSyncSet: use specified OCI image (#2722)
justinsb Feb 4, 2022
c194c7a
RemoteRootSyncSet: apply changes with force (#2723)
justinsb Feb 4, 2022
3354360
RemoteRootSyncSet: Remove hack where we set namespace (#2724)
justinsb Feb 4, 2022
9e84660
Create push-images target to push all our images (#2721)
justinsb Feb 4, 2022
2f13f40
Create dockerfile / makefile / manifest for pushing controllers to cl…
justinsb Feb 4, 2022
3a53c84
Introduce mapTaskToMutation function (#2744)
justinsb Feb 4, 2022
3f08852
Fix kpt file system interactions (#2746)
martinmaly Feb 5, 2022
78b721d
Pass Function Config to Eval (#2747)
martinmaly Feb 5, 2022
a4fe965
Connect to gRPC function runner (#2745)
martinmaly Feb 5, 2022
adbae18
Fix crash (#2748)
martinmaly Feb 5, 2022
a95b902
Fix clone directory rewriting (#2749)
martinmaly Feb 5, 2022
14ac238
client generation: fix plural of packagerevisionresources (#2751)
justinsb Feb 7, 2022
855ad0c
Update kpt dependencies (#2743)
martinmaly Feb 7, 2022
d6824f6
Merge main into porch
martinmaly Feb 7, 2022
139edeb
Streamline Docker Image Building (#2752)
martinmaly Feb 7, 2022
467885c
Run Porch With Consistent Working Dir (#2753)
martinmaly Feb 7, 2022
1427fd4
Add subpkgs test for porch (#2754)
phanimarupaka Feb 8, 2022
c78c345
Basic e2e Test (#2755)
martinmaly Feb 8, 2022
6aecd74
Refactor Server Startup (#2770)
martinmaly Feb 9, 2022
29a3934
Tidy in 1.17 compatible mode (#2769)
martinmaly Feb 9, 2022
61d462a
Create Engine using Options (#2771)
martinmaly Feb 9, 2022
12c69a2
Support lazy credential resolution (#2772)
martinmaly Feb 10, 2022
b725aa5
Pass Context to OpenRepository (#2773)
martinmaly Feb 10, 2022
c60c96c
Use Context to Drive Server Shutdown (#2774)
martinmaly Feb 10, 2022
ce6007b
Clean up Required/Optional API Fields (#2778)
martinmaly Feb 11, 2022
fcfea80
Easier deployment onto GKE (#2776)
justinsb Feb 11, 2022
f6ae5b0
Support Creating Porch Deployment Config (#2777)
martinmaly Feb 12, 2022
7e8df2e
Update Porch Deployment and Instructions (#2782)
martinmaly Feb 14, 2022
d8c261f
Use controller-gen v0.8.0 (#2780)
martinmaly Feb 14, 2022
1ba3852
Set renderer when building CaDEngine (#2787)
justinsb Feb 15, 2022
424455d
Fix missing error handling (#2784)
justinsb Feb 15, 2022
ff5182a
Fix small typo (#2793)
justinsb Feb 15, 2022
507fe77
Don't call into kpt render if we don't have a package (#2788)
justinsb Feb 15, 2022
02afbf4
Merge main into porch
martinmaly Feb 16, 2022
69fc68b
Split git_test To Use Git Server (#2797)
martinmaly Feb 17, 2022
60026d7
Add CreatePackageRevision Test (#2800)
martinmaly Feb 17, 2022
64400a5
Cache apply-setters:v0.1 function (#2799)
martinmaly Feb 17, 2022
8c583a7
Return Git PackageRevisionResources Correctly (#2801)
martinmaly Feb 17, 2022
80d3877
Make Git Server hostable in cluster (#2798)
martinmaly Feb 17, 2022
132abb5
Add PackageRevision Approval API (#2810)
martinmaly Feb 17, 2022
e0ed44f
Add Clone Package Test (#2807)
martinmaly Feb 17, 2022
2307648
Revert OCI and Location (#2814)
martinmaly Feb 18, 2022
881b7f0
Pre-merge Cleanup (#2816)
martinmaly Feb 22, 2022
f1dbc0b
Cleanup Code (#2811)
martinmaly Feb 22, 2022
18a9945
Merge main into porch
martinmaly Feb 22, 2022
0aec520
Use k8s Dependencies v0.23.2
martinmaly Feb 22, 2022
0fa4a0a
Merge porch into main
martinmaly Feb 22, 2022
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
48 changes: 48 additions & 0 deletions .github/workflows/porch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Porch

on:
push:
paths-ignore:
- "docs/**"
- "site/**"
pull_request:
paths-ignore:
- "docs/**"
- "site/**"

jobs:
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things that will help us to analyze if we need to adjust the presubmit workflow (locally and in CI)

  • How long does the porch specific tests take ?
  • What dependencies do a kpt contributor needs to install to run tests for porch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Porch tests are about 5 mins (https://github.com/GoogleContainerTools/kpt/actions/runs/1867953046)

no dependencies needed.

The e2e tests will have mode where they run against a k8s cluster where they'd install Porch but that part is not yet implemented.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok.

tests:
name: Porch Unit Tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17.6
- name: Run Porch Unit Tests
uses: actions/checkout@v2
- name: Verify format / headers etc
run: hack/verify-fix-all.sh
working-directory: ./porch
- name: Build
run: make porch
working-directory: ./porch
- name: Test
run: make test
working-directory: ./porch
- name: Tidy
run: make tidy
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ require (
github.com/google/go-cmp v0.5.6
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/igorsobreira/titlecase v0.0.0-20140109233139-4156b5b858ac
github.com/otiai10/copy v1.6.0
github.com/otiai10/copy v1.7.0
github.com/philopon/go-toposort v0.0.0-20170620085441-9be86dbd762f
github.com/spf13/cobra v1.3.0
github.com/stretchr/testify v1.7.0
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca
github.com/xlab/treeprint v1.1.0
golang.org/x/mod v0.5.1
gotest.tools v2.2.0+incompatible
k8s.io/api v0.23.2
martinmaly marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,13 @@ github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ=
github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E=
github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE=
github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E=
github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI=
github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
Expand Down Expand Up @@ -613,8 +613,9 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca h1:1CFlNzQhALwjS9mBAUkycX616GzgsuYUOCHA5+HSlXI=
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk=
github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
9 changes: 8 additions & 1 deletion internal/cmddiff/cmddiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
"github.com/GoogleContainerTools/kpt/internal/util/argutil"
"github.com/GoogleContainerTools/kpt/internal/util/cmdutil"
"github.com/GoogleContainerTools/kpt/internal/util/diff"
"github.com/GoogleContainerTools/kpt/internal/util/pathutil"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

// NewRunner returns a command runner.
Expand Down Expand Up @@ -100,7 +102,12 @@ func (r *Runner) preRunE(_ *cobra.Command, args []string) error {
return err
}

p, err := pkg.New(resolvedPath)
absResolvedPath, _, err := pathutil.ResolveAbsAndRelPaths(resolvedPath)
if err != nil {
return err
}

p, err := pkg.New(filesys.FileSystemOrOnDisk{}, absResolvedPath)
if err != nil {
return err
}
Expand Down
9 changes: 8 additions & 1 deletion internal/cmdget/cmdget.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import (
"github.com/GoogleContainerTools/kpt/internal/util/cmdutil"
"github.com/GoogleContainerTools/kpt/internal/util/get"
"github.com/GoogleContainerTools/kpt/internal/util/parse"
"github.com/GoogleContainerTools/kpt/internal/util/pathutil"
kptfilev1 "github.com/GoogleContainerTools/kpt/pkg/api/kptfile/v1"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

// NewRunner returns a command runner
Expand Down Expand Up @@ -90,7 +92,12 @@ func (r *Runner) preRunE(_ *cobra.Command, args []string) error {
}

r.Get.Git = &t.Git
p, err := pkg.New(t.Destination)
absDestPath, _, err := pathutil.ResolveAbsAndRelPaths(t.Destination)
if err != nil {
return err
}

p, err := pkg.New(filesys.FileSystemOrOnDisk{}, absDestPath)
if err != nil {
return errors.E(op, types.UniquePath(t.Destination), err)
}
Expand Down
9 changes: 8 additions & 1 deletion internal/cmdinit/cmdinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import (
"github.com/GoogleContainerTools/kpt/internal/printer"
"github.com/GoogleContainerTools/kpt/internal/util/cmdutil"
"github.com/GoogleContainerTools/kpt/internal/util/man"
"github.com/GoogleContainerTools/kpt/internal/util/pathutil"
kptfilev1 "github.com/GoogleContainerTools/kpt/pkg/api/kptfile/v1"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/errors"
"sigs.k8s.io/kustomize/kyaml/filesys"
"sigs.k8s.io/kustomize/kyaml/yaml"
)

Expand Down Expand Up @@ -75,7 +77,12 @@ func (r *Runner) runE(c *cobra.Command, args []string) error {
if len(args) == 0 {
args = append(args, pkg.CurDir)
}
p, err := pkg.New(args[0])

absPath, _, err := pathutil.ResolveAbsAndRelPaths(args[0])
if err != nil {
return err
}
p, err := pkg.New(filesys.FileSystemOrOnDisk{}, absPath)
if err != nil {
return err
}
Expand Down
19 changes: 13 additions & 6 deletions internal/cmdliveinit/cmdliveinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ import (
"github.com/GoogleContainerTools/kpt/internal/printer"
"github.com/GoogleContainerTools/kpt/internal/types"
"github.com/GoogleContainerTools/kpt/internal/util/attribution"
"github.com/GoogleContainerTools/kpt/internal/util/pathutil"
kptfilev1 "github.com/GoogleContainerTools/kpt/pkg/api/kptfile/v1"
rgfilev1alpha1 "github.com/GoogleContainerTools/kpt/pkg/api/resourcegroup/v1alpha1"
"github.com/GoogleContainerTools/kpt/pkg/kptfile/kptfileutil"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
k8scmdutil "k8s.io/kubectl/pkg/cmd/util"
"sigs.k8s.io/cli-utils/pkg/common"
"sigs.k8s.io/cli-utils/pkg/config"
"sigs.k8s.io/kustomize/kyaml/filesys"
"sigs.k8s.io/kustomize/kyaml/yaml"
)

Expand Down Expand Up @@ -60,7 +62,7 @@ func (i *InvInKfExistsError) Error() string {
return "inventory information already set within Kptfile for package"
}

func NewRunner(ctx context.Context, factory cmdutil.Factory,
func NewRunner(ctx context.Context, factory k8scmdutil.Factory,
ioStreams genericclioptions.IOStreams) *Runner {
r := &Runner{
ctx: ctx,
Expand All @@ -84,7 +86,7 @@ func NewRunner(ctx context.Context, factory cmdutil.Factory,
return r
}

func NewCommand(ctx context.Context, f cmdutil.Factory,
func NewCommand(ctx context.Context, f k8scmdutil.Factory,
ioStreams genericclioptions.IOStreams) *cobra.Command {
return NewRunner(ctx, f, ioStreams).Command
}
Expand All @@ -93,7 +95,7 @@ type Runner struct {
ctx context.Context
Command *cobra.Command

factory cmdutil.Factory
factory k8scmdutil.Factory
ioStreams genericclioptions.IOStreams
Force bool // Set inventory values even if already set in Kptfile
Name string // Inventory object name
Expand All @@ -119,7 +121,12 @@ func (r *Runner) runE(_ *cobra.Command, args []string) error {
return errors.E(op, err)
}

p, err := pkg.New(dir)
absPath, _, err := pathutil.ResolveAbsAndRelPaths(dir)
if err != nil {
return err
}

p, err := pkg.New(filesys.FileSystemOrOnDisk{}, absPath)
if err != nil {
return errors.E(op, err)
}
Expand All @@ -143,7 +150,7 @@ func (r *Runner) runE(_ *cobra.Command, args []string) error {
// the inventory information in the Kptfile.
type ConfigureInventoryInfo struct {
Pkg *pkg.Pkg
Factory cmdutil.Factory
Factory k8scmdutil.Factory
Quiet bool

Name string
Expand Down
3 changes: 2 additions & 1 deletion internal/cmdliveinit/cmdliveinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/stretchr/testify/assert"
"k8s.io/cli-runtime/pkg/genericclioptions"
cmdtesting "k8s.io/kubectl/pkg/cmd/testing"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

var (
Expand Down Expand Up @@ -293,7 +294,7 @@ func TestCmd_Run(t *testing.T) {
// Otherwise, validate the kptfile values and/or resourcegroup values.
var actualInv kptfilev1.Inventory
assert.NoError(t, err)
kf, err := pkg.ReadKptfile(w.WorkspaceDirectory)
kf, err := pkg.ReadKptfile(filesys.FileSystemOrOnDisk{}, w.WorkspaceDirectory)
assert.NoError(t, err)

switch tc.rgfilename {
Expand Down
12 changes: 9 additions & 3 deletions internal/cmdmigrate/migratecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/GoogleContainerTools/kpt/internal/pkg"
"github.com/GoogleContainerTools/kpt/internal/types"
"github.com/GoogleContainerTools/kpt/internal/util/argutil"
"github.com/GoogleContainerTools/kpt/internal/util/pathutil"
"github.com/GoogleContainerTools/kpt/pkg/kptfile/kptfileutil"
"github.com/GoogleContainerTools/kpt/pkg/live"
"github.com/spf13/cobra"
Expand All @@ -31,6 +32,7 @@ import (
"sigs.k8s.io/cli-utils/pkg/inventory"
"sigs.k8s.io/cli-utils/pkg/manifestreader"
"sigs.k8s.io/cli-utils/pkg/object"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

// MigrateRunner encapsulates fields for the kpt migrate command.
Expand Down Expand Up @@ -212,7 +214,11 @@ func (mr *MigrateRunner) applyCRD() error {
func (mr *MigrateRunner) updateKptfile(ctx context.Context, args []string, prevID string) error {
fmt.Fprint(mr.ioStreams.Out, " updating Kptfile inventory values...")
if !mr.dryRun {
p, err := pkg.New(args[0])
absPath, _, err := pathutil.ResolveAbsAndRelPaths(args[0])
if err != nil {
return err
}
p, err := pkg.New(filesys.FileSystemOrOnDisk{}, absPath)
if err != nil {
return err
}
Expand Down Expand Up @@ -458,7 +464,7 @@ func (mr *MigrateRunner) migrateKptfileToRG(args []string) error {
fmt.Fprint(mr.ioStreams.Out, " reading existing Kptfile...")
if !mr.dryRun {
dir := args[0]
p, err := pkg.New(dir)
p, err := pkg.New(filesys.FileSystemOrOnDisk{}, dir)
if err != nil {
return err
}
Expand Down Expand Up @@ -550,7 +556,7 @@ func (mr *MigrateRunner) migrateCMToRG(stdinBytes []byte, args []string) error {
func (mr *MigrateRunner) createRGfile(ctx context.Context, args []string, prevID string) error {
fmt.Fprint(mr.ioStreams.Out, " creating ResourceGroup object file...")
if !mr.dryRun {
p, err := pkg.New(args[0])
p, err := pkg.New(filesys.FileSystemOrOnDisk{}, args[0])
if err != nil {
return err
}
Expand Down
5 changes: 3 additions & 2 deletions internal/cmdmigrate/migratecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"sigs.k8s.io/cli-utils/pkg/inventory"
"sigs.k8s.io/cli-utils/pkg/manifestreader"
"sigs.k8s.io/cli-utils/pkg/object"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

var testNamespace = "test-inventory-namespace"
Expand Down Expand Up @@ -158,7 +159,7 @@ func TestKptMigrate_updateKptfile(t *testing.T) {
return
}
assert.NoError(t, err)
kf, err := pkg.ReadKptfile(dir)
kf, err := pkg.ReadKptfile(filesys.FileSystemOrOnDisk{}, dir)
if !assert.NoError(t, err) {
t.FailNow()
}
Expand Down Expand Up @@ -257,7 +258,7 @@ func TestKptMigrate_migrateKptfileToRG(t *testing.T) {
return
}
assert.NoError(t, err)
kf, err := pkg.ReadKptfile(dir)
kf, err := pkg.ReadKptfile(filesys.FileSystemOrOnDisk{}, dir)
if !assert.NoError(t, err) {
t.FailNow()
}
Expand Down
12 changes: 10 additions & 2 deletions internal/cmdrender/cmdrender.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import (
"github.com/GoogleContainerTools/kpt/internal/printer"
"github.com/GoogleContainerTools/kpt/internal/util/argutil"
"github.com/GoogleContainerTools/kpt/internal/util/cmdutil"
"github.com/GoogleContainerTools/kpt/internal/util/pathutil"
"github.com/GoogleContainerTools/kpt/internal/util/render"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

// NewRunner returns a command runner
Expand Down Expand Up @@ -108,12 +111,17 @@ func (r *Runner) runE(c *cobra.Command, _ []string) error {
// capture the content to be written
output = &outContent
}
executor := Executor{
PkgPath: r.pkgPath,
absPkgPath, _, err := pathutil.ResolveAbsAndRelPaths(r.pkgPath)
if err != nil {
return err
}
executor := render.Renderer{
PkgPath: absPkgPath,
ResultsDirPath: r.resultsDirPath,
Output: output,
ImagePullPolicy: cmdutil.StringToImagePullPolicy(r.imagePullPolicy),
AllowExec: r.allowExec,
FileSystem: filesys.FileSystemOrOnDisk{},
}
if err := executor.Execute(r.ctx); err != nil {
return err
Expand Down
9 changes: 7 additions & 2 deletions internal/cmdupdate/cmdupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ import (
"github.com/GoogleContainerTools/kpt/internal/types"
"github.com/GoogleContainerTools/kpt/internal/util/argutil"
"github.com/GoogleContainerTools/kpt/internal/util/cmdutil"
"github.com/GoogleContainerTools/kpt/internal/util/pathutil"
"github.com/GoogleContainerTools/kpt/internal/util/update"
kptfilev1 "github.com/GoogleContainerTools/kpt/pkg/api/kptfile/v1"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

// NewRunner returns a command runner.
Expand Down Expand Up @@ -94,8 +96,11 @@ func (r *Runner) preRunE(_ *cobra.Command, args []string) error {
if err != nil {
return err
}

p, err := pkg.New(resolvedPath)
absResolvedPath, _, err := pathutil.ResolveAbsAndRelPaths(resolvedPath)
if err != nil {
return err
}
p, err := pkg.New(filesys.FileSystemOrOnDisk{}, absResolvedPath)
if err != nil {
return errors.E(op, err)
}
Expand Down
Loading