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

[WIP] Update cli-utils to v0.27.0 #2581

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
k8s.io/klog/v2 v2.10.0
k8s.io/kubectl v0.22.2
k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e
sigs.k8s.io/cli-utils v0.26.1-0.20211020064957-d62b5c62002d
sigs.k8s.io/cli-utils v0.26.1-0.20211111225114-39f77432ba99
sigs.k8s.io/kustomize/api v0.8.11
sigs.k8s.io/kustomize/kyaml v0.12.1-0.20211012224254-55ac9ca88db9
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,8 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/cli-utils v0.26.1-0.20211020064957-d62b5c62002d h1:yxJZ6HujyxXTLuHuZ8/HkzWy6g+eTpslhUzAzPpA9dE=
sigs.k8s.io/cli-utils v0.26.1-0.20211020064957-d62b5c62002d/go.mod h1:8ll2fyx+bzjbwmwUnKBQU+2LDbMDsxy44DiDZ+drALg=
sigs.k8s.io/cli-utils v0.26.1-0.20211111225114-39f77432ba99 h1:XXjbg+pG8zO2oWcH/UtF2wJwEpy6sYOkPOAaIR1N4qM=
sigs.k8s.io/cli-utils v0.26.1-0.20211111225114-39f77432ba99/go.mod h1:8ll2fyx+bzjbwmwUnKBQU+2LDbMDsxy44DiDZ+drALg=
sigs.k8s.io/controller-runtime v0.10.1 h1:+eLHgY/VrJWnfg6iXUqhCUqNXgPH1NZeP9drNAAgWlg=
sigs.k8s.io/controller-runtime v0.10.1/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY=
sigs.k8s.io/kustomize/api v0.8.11 h1:LzQzlq6Z023b+mBtc6v72N2mSHYmN8x7ssgbf/hv0H8=
Expand Down
7 changes: 1 addition & 6 deletions internal/cmdapply/cmdapply.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"sigs.k8s.io/cli-utils/pkg/apply"
"sigs.k8s.io/cli-utils/pkg/common"
"sigs.k8s.io/cli-utils/pkg/inventory"
status "sigs.k8s.io/cli-utils/pkg/util/factory"
)

// NewRunner returns a command runner
Expand Down Expand Up @@ -208,15 +207,11 @@ func runApply(r *Runner, invInfo inventory.InventoryInfo, objs []*unstructured.U

// Run the applier. It will return a channel where we can receive updates
// to keep track of progress and any issues.
poller, err := status.NewStatusPoller(r.factory)
if err != nil {
return err
}
invClient, err := inventory.NewInventoryClient(r.factory, live.WrapInventoryObj, live.InvToUnstructuredFunc)
if err != nil {
return err
}
applier, err := apply.NewApplier(r.factory, invClient, poller)
applier, err := apply.NewApplier(r.factory, invClient)
if err != nil {
return err
}
Expand Down
7 changes: 1 addition & 6 deletions internal/cmddestroy/cmddestroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"sigs.k8s.io/cli-utils/pkg/apply"
"sigs.k8s.io/cli-utils/pkg/common"
"sigs.k8s.io/cli-utils/pkg/inventory"
status "sigs.k8s.io/cli-utils/pkg/util/factory"
)

func NewRunner(ctx context.Context, factory util.Factory,
Expand Down Expand Up @@ -154,15 +153,11 @@ func (r *Runner) runE(c *cobra.Command, args []string) error {
func runDestroy(r *Runner, inv inventory.InventoryInfo, dryRunStrategy common.DryRunStrategy) error {
// Run the destroyer. It will return a channel where we can receive updates
// to keep track of progress and any issues.
poller, err := status.NewStatusPoller(r.factory)
if err != nil {
return err
}
invClient, err := inventory.NewInventoryClient(r.factory, live.WrapInventoryObj, live.InvToUnstructuredFunc)
if err != nil {
return err
}
destroyer, err := apply.NewDestroyer(r.factory, invClient, poller)
destroyer, err := apply.NewDestroyer(r.factory, invClient)
if err != nil {
return err
}
Expand Down
16 changes: 9 additions & 7 deletions internal/cmdmigrate/migratecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,18 @@ func (mr *MigrateRunner) retrieveConfigMapInv(reader io.Reader, args []string) (
if err != nil {
return nil, err
}
cmInv, _, err := mr.cmLoader.InventoryInfo(objs)
cmInvObj, _, err := inventory.SplitUnstructureds(objs)
if err != nil {
return nil, err
}
if cmInvObj == nil {
// No ConfigMap inventory means the migration has already run before.
if _, ok := err.(inventory.NoInventoryObjError); ok { //nolint
fmt.Fprintln(mr.ioStreams.Out, "no ConfigMap inventory...completed")
}
} else {
fmt.Fprintf(mr.ioStreams.Out, "success (inventory-id: %s)\n", cmInv.ID())
fmt.Fprintln(mr.ioStreams.Out, "no ConfigMap inventory...completed")
return nil, inventory.NoInventoryObjError{}
}
return cmInv, err
cmInv := inventory.WrapInventoryInfoObj(cmInvObj)
fmt.Fprintf(mr.ioStreams.Out, "success (inventory-id: %s)\n", cmInv.ID())
return cmInv, nil
}

// retrieveInvObjs returns the object references from the passed
Expand Down
4 changes: 3 additions & 1 deletion pkg/live/apply-crd-task.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,6 @@ func (a *ApplyCRDTask) Start(taskContext *taskrunner.TaskContext) {
}()
}

func (a *ApplyCRDTask) ClearTimeout() {}
func (a *ApplyCRDTask) Cancel(_ *taskrunner.TaskContext) {}

func (a *ApplyCRDTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata) {}
2 changes: 1 addition & 1 deletion pkg/live/rgpath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestPathManifestReader_Read(t *testing.T) {
"cr.yaml": cr,
},
namespace: "test-namespace",
expectedErrMsg: "unknown resource types: Custom.custom.io",
expectedErrMsg: "unknown resource types: custom.io/v1, Kind=Custom",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

},
"local-config is filtered out": {
manifests: map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion pkg/live/rgstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestResourceStreamManifestReader_Read(t *testing.T) {
"cr.yaml": cr,
},
namespace: "test-namespace",
expectedErrMsg: "unknown resource types: Custom.custom.io",
expectedErrMsg: "unknown resource types: custom.io/v1, Kind=Custom",
},
}

Expand Down