Skip to content

Commit

Permalink
Fix deprecated client-pkg in favor of knative.dev/client/pkg (#365)
Browse files Browse the repository at this point in the history
* Fix deprecated client-pkg in favor of knative.dev/client/pkg

* Fix formatting
  • Loading branch information
dsimansk authored Jan 23, 2025
1 parent aeb1784 commit 5b39563
Show file tree
Hide file tree
Showing 296 changed files with 9,017 additions and 9,325 deletions.
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ go 1.22.7

require (
github.com/hashicorp/golang-lru v1.0.2
github.com/hashicorp/hcl v1.0.0
github.com/hashicorp/hcl v1.0.1-vault-5
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.13.0
github.com/spf13/viper v1.16.0
gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.3.0
k8s.io/api v0.31.4
k8s.io/apimachinery v0.31.4
k8s.io/client-go v0.31.4
knative.dev/client-pkg v0.0.0-20250123014150-0acf80a54bc4
knative.dev/client/pkg v0.0.0-20250123014217-178db3230101
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5
knative.dev/networking v0.0.0-20250117155906-67d1c274ba6a
knative.dev/serving v0.44.0
Expand All @@ -22,6 +22,7 @@ require (
require (
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
emperror.dev/errors v0.8.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down Expand Up @@ -63,20 +64,19 @@ require (
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.20.4 // indirect
Expand All @@ -87,11 +87,11 @@ require (
github.com/rickb777/date v1.20.0 // indirect
github.com/rickb777/plural v1.4.1 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
Expand Down Expand Up @@ -121,7 +121,7 @@ require (
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect
knative.dev/eventing v0.43.0 // indirect
knative.dev/eventing v0.44.0 // indirect
knative.dev/pkg v0.0.0-20250117084104-c43477f0052b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
Expand Down
71 changes: 39 additions & 32 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/command/autoscaling/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
"knative.dev/client-pkg/pkg/commands/flags"
hprinters "knative.dev/client-pkg/pkg/printers"
"knative.dev/client/pkg/commands/flags"
hprinters "knative.dev/client/pkg/printers"
"knative.dev/kn-plugin-admin/pkg"
"knative.dev/serving/pkg/autoscaler/config"
"knative.dev/serving/pkg/autoscaler/config/autoscalerconfig"
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/autoscaling/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"gotest.tools/v3/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/client-pkg/pkg/util"
"knative.dev/client/pkg/util"
"knative.dev/kn-plugin-admin/pkg/testutil"
"knative.dev/serving/pkg/autoscaler/config"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/autoscaling/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"

"knative.dev/client-pkg/pkg/flags"
"knative.dev/client/pkg/flags"

as "knative.dev/serving/pkg/apis/autoscaling"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/command/cdc/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"knative.dev/client-pkg/pkg/commands/flags"
"knative.dev/client-pkg/pkg/printers"
hprinters "knative.dev/client-pkg/pkg/printers"
"knative.dev/client/pkg/commands/flags"
"knative.dev/client/pkg/printers"
hprinters "knative.dev/client/pkg/printers"
"knative.dev/kn-plugin-admin/pkg"
typev1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/domain/human_readable_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"

hprinters "knative.dev/client-pkg/pkg/printers"
hprinters "knative.dev/client/pkg/printers"
)

// DomainListHandlers adds print handlers for domain list command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/domain/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/client-pkg/pkg/commands/flags"
"knative.dev/client/pkg/commands/flags"
"knative.dev/kn-plugin-admin/pkg"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/command/domain/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"gotest.tools/v3/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/client-pkg/pkg/util"
"knative.dev/client/pkg/util"

"knative.dev/kn-plugin-admin/pkg/testutil"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/registry/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/client-pkg/pkg/commands"
"knative.dev/client/pkg/commands"
"knative.dev/kn-plugin-admin/pkg"

"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/registry/human_readable_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/runtime"

hprinters "knative.dev/client-pkg/pkg/printers"
hprinters "knative.dev/client/pkg/printers"
)

// RegistryListHandlers adds print handlers for registry list command
Expand Down
4 changes: 2 additions & 2 deletions pkg/command/registry/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"

"knative.dev/client-pkg/pkg/commands"
"knative.dev/client-pkg/pkg/commands/flags"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/commands/flags"
"knative.dev/kn-plugin-admin/pkg"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/command/registry/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/client-go/kubernetes"
k8sfake "k8s.io/client-go/kubernetes/fake"

"knative.dev/client-pkg/pkg/util"
"knative.dev/client/pkg/util"
"knative.dev/kn-plugin-admin/pkg"
"knative.dev/kn-plugin-admin/pkg/testutil"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/registry/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"

"knative.dev/client-pkg/pkg/commands"
"knative.dev/client/pkg/commands"
"knative.dev/kn-plugin-admin/pkg"

"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"knative.dev/kn-plugin-admin/core"

"knative.dev/client-pkg/pkg/plugin"
"knative.dev/client/pkg/plugin"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,69 @@ import (
"runtime"
"strings"

homedir "github.com/mitchellh/go-homedir"
test2 "knative.dev/client-pkg/pkg/util/test"
"github.com/mitchellh/go-homedir"
"knative.dev/client/pkg/util/test"
)

type E2ETest struct {
knTest *test.KnTest
knPlugin *knPlugin
}

// NewE2ETest for pluginName in pluginPath
func NewE2ETest(pluginName string, pluginPath string, install bool) (*E2ETest, error) {
knTest, err := test.NewKnTest()
if err != nil {
return nil, err
}

knPlugin := &knPlugin{
kn: knTest.Kn(),
pluginName: pluginName,
pluginPath: pluginPath,
install: install,
}

e2eTest := &E2ETest{
knTest: knTest,
knPlugin: knPlugin,
}

return e2eTest, nil
}

// KnTest object
func (e2eTest *E2ETest) KnTest() *test.KnTest {
return e2eTest.knTest
}

// KnPlugin object
func (e2eTest *E2ETest) KnPlugin() *knPlugin {
return e2eTest.knPlugin
}

type knPlugin struct {
kn test2.Kn
kn test.Kn
pluginName string
pluginPath string
install bool
}

// Run the KnPlugin returning a KnRunResult
func (kp *knPlugin) Run(args ...string) test2.KnRunResult {
func (kp *knPlugin) Run(args ...string) test.KnRunResult {
if kp.install {
err := kp.Install()
if err != nil {
fmt.Printf("error installing kn plugin: %s\n", err.Error())
return test2.KnRunResult{}
return test.KnRunResult{}
}
defer kp.Uninstall()
}
return RunKnPlugin(kp.kn.Namespace(), kp.pluginName, args)
}

// Kn object to run `kn`
func (kp *knPlugin) Kn() test2.Kn {
func (kp *knPlugin) Kn() test.Kn {
return kp.kn
}

Expand Down Expand Up @@ -153,9 +190,9 @@ func pluginArgs(pluginName string) []string {
return pluginParts[1:]
}

func RunKnPlugin(namespace string, pluginName string, args []string) test2.KnRunResult {
func RunKnPlugin(namespace string, pluginName string, args []string) test.KnRunResult {
pluginArgs := pluginArgs(pluginName)
args = append(args, []string{"--namespace", namespace}...)
argsWithPlugin := append(pluginArgs, args...)
return test2.RunKn(namespace, argsWithPlugin)
return test.RunKn(namespace, argsWithPlugin)
}
9 changes: 4 additions & 5 deletions test/e2e/kn_admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ import (
"testing"

"gotest.tools/v3/assert"
testcommon "knative.dev/client-pkg/pkg/kn-source-pkg/test/e2e"
"knative.dev/client-pkg/pkg/util"
"knative.dev/client-pkg/pkg/util/test"
"knative.dev/client/pkg/util"
"knative.dev/client/pkg/util/test"
"knative.dev/kn-plugin-admin/pkg/command/autoscaling"
"knative.dev/serving/pkg/autoscaler/config"
)

const pluginName string = "admin"

type e2eTest struct {
it *testcommon.E2ETest
it *E2ETest
kn *test.Kn
kubectl *test.Kubectl
backupData map[string]string
Expand All @@ -48,7 +47,7 @@ func newE2ETest(t *testing.T) *e2eTest {
return nil
}

it, err := testcommon.NewE2ETest("kn-admin", filepath.Join(currentDir, "../.."), false)
it, err := NewE2ETest("kn-admin", filepath.Join(currentDir, "../.."), false)
if err != nil {
return nil
}
Expand Down
12 changes: 12 additions & 0 deletions vendor/emperror.dev/errors/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.go]
indent_style = tab
14 changes: 14 additions & 0 deletions vendor/emperror.dev/errors/.fossa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
cli:
server: https://app.fossa.com
fetcher: custom
project: emperror.dev/errors
analyze:
modules:
- name: emperror.dev/errors
type: go
target: emperror.dev/errors
strategy: gomodules
path: .
options:
allow-unresolved: true
6 changes: 6 additions & 0 deletions vendor/emperror.dev/errors/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/tmp/
/vendor/

# Please output directory and local configuration
plz-out
.plzconfig.local
Loading

0 comments on commit 5b39563

Please sign in to comment.