From 6f401040b7ab4c966395920f54e4fa7748ad83bf Mon Sep 17 00:00:00 2001 From: "L.Dongming" Date: Fri, 13 Oct 2023 18:18:56 +0800 Subject: [PATCH] chore: cli does not use cli-runtime deprecated method (#5406) (cherry picked from commit 6ed51fb95cbdeec1c18793e66c01a80db7e0efaa) --- internal/cli/cmd/accounts/base.go | 6 +-- internal/cli/cmd/accounts/base_test.go | 6 +-- internal/cli/cmd/accounts/create.go | 4 +- internal/cli/cmd/accounts/create_test.go | 7 ++-- internal/cli/cmd/accounts/delete.go | 4 +- internal/cli/cmd/accounts/delete_test.go | 6 +-- internal/cli/cmd/accounts/describe.go | 4 +- internal/cli/cmd/accounts/describe_test.go | 6 +-- internal/cli/cmd/accounts/grant.go | 4 +- internal/cli/cmd/accounts/grant_test.go | 6 +-- internal/cli/cmd/accounts/list.go | 4 +- internal/cli/cmd/accounts/list_test.go | 7 ++-- internal/cli/cmd/addon/addon.go | 14 +++---- internal/cli/cmd/addon/addon_test.go | 6 +-- internal/cli/cmd/alert/add_receiver.go | 6 +-- internal/cli/cmd/alert/add_receiver_test.go | 8 ++-- internal/cli/cmd/alert/alert_test.go | 4 +- internal/cli/cmd/alert/alter.go | 4 +- internal/cli/cmd/alert/config_smtpserver.go | 4 +- .../cli/cmd/alert/config_smtpserver_test.go | 8 ++-- internal/cli/cmd/alert/delete_receiver.go | 4 +- .../cli/cmd/alert/delete_receiver_test.go | 7 ++-- internal/cli/cmd/alert/list_receivers.go | 4 +- internal/cli/cmd/alert/list_receivers_test.go | 6 +-- internal/cli/cmd/alert/list_smtpserver.go | 4 +- .../cli/cmd/alert/list_smtpserver_test.go | 6 +-- .../cli/cmd/auth/authorize/issued_provider.go | 4 +- .../auth/authorize/issued_provoder_test.go | 6 +-- internal/cli/cmd/auth/login.go | 8 ++-- internal/cli/cmd/auth/logout.go | 4 +- internal/cli/cmd/backuprepo/backuprepo.go | 4 +- .../cli/cmd/backuprepo/backuprepo_test.go | 6 +-- internal/cli/cmd/backuprepo/create.go | 6 +-- internal/cli/cmd/backuprepo/create_test.go | 7 ++-- internal/cli/cmd/backuprepo/describe.go | 6 +-- internal/cli/cmd/backuprepo/list.go | 4 +- internal/cli/cmd/bench/bench.go | 20 +++++----- internal/cli/cmd/bench/bench_test.go | 6 +-- internal/cli/cmd/bench/pgbench.go | 4 +- internal/cli/cmd/bench/sysbench.go | 4 +- internal/cli/cmd/bench/tpcc.go | 4 +- internal/cli/cmd/bench/tpch.go | 4 +- internal/cli/cmd/bench/ycsb.go | 4 +- internal/cli/cmd/builder/builder.go | 4 +- internal/cli/cmd/builder/builder_test.go | 6 +-- internal/cli/cmd/builder/template/template.go | 6 +-- .../cli/cmd/builder/template/template_test.go | 6 +-- .../cli/cmd/builder/tools/migrate_scripts.go | 6 +-- internal/cli/cmd/class/class.go | 4 +- internal/cli/cmd/class/class_test.go | 6 +-- internal/cli/cmd/class/create.go | 6 +-- internal/cli/cmd/class/create_test.go | 6 +-- internal/cli/cmd/class/list.go | 6 +-- internal/cli/cmd/class/list_test.go | 6 +-- internal/cli/cmd/class/template.go | 6 +-- internal/cli/cmd/class/template_test.go | 6 +-- internal/cli/cmd/cli.go | 4 +- internal/cli/cmd/cluster/accounts.go | 14 +++---- internal/cli/cmd/cluster/cluster.go | 4 +- internal/cli/cmd/cluster/cluster_test.go | 6 +-- internal/cli/cmd/cluster/config_diff.go | 4 +- internal/cli/cmd/cluster/config_edit.go | 4 +- internal/cli/cmd/cluster/config_observer.go | 6 +-- internal/cli/cmd/cluster/config_ops.go | 4 +- internal/cli/cmd/cluster/config_ops_test.go | 6 +-- internal/cli/cmd/cluster/config_util_test.go | 4 +- internal/cli/cmd/cluster/connect.go | 4 +- internal/cli/cmd/cluster/connect_test.go | 7 ++-- internal/cli/cmd/cluster/create.go | 6 +-- .../cli/cmd/cluster/create_subcmds_test.go | 6 +-- internal/cli/cmd/cluster/create_test.go | 4 +- internal/cli/cmd/cluster/dataprotection.go | 24 ++++++------ .../cli/cmd/cluster/dataprotection_test.go | 6 +-- internal/cli/cmd/cluster/delete.go | 4 +- internal/cli/cmd/cluster/delete_ops.go | 4 +- internal/cli/cmd/cluster/delete_ops_test.go | 6 +-- internal/cli/cmd/cluster/describe.go | 8 ++-- internal/cli/cmd/cluster/describe_ops.go | 8 ++-- internal/cli/cmd/cluster/describe_ops_test.go | 6 +-- internal/cli/cmd/cluster/describe_test.go | 6 +-- internal/cli/cmd/cluster/label.go | 8 ++-- internal/cli/cmd/cluster/label_test.go | 6 +-- internal/cli/cmd/cluster/list.go | 10 ++--- internal/cli/cmd/cluster/list_logs.go | 6 +-- internal/cli/cmd/cluster/list_logs_test.go | 6 +-- internal/cli/cmd/cluster/list_ops.go | 4 +- internal/cli/cmd/cluster/list_ops_test.go | 8 ++-- internal/cli/cmd/cluster/list_test.go | 6 +-- internal/cli/cmd/cluster/logs.go | 4 +- internal/cli/cmd/cluster/logs_test.go | 4 +- internal/cli/cmd/cluster/operations.go | 24 ++++++------ internal/cli/cmd/cluster/operations_test.go | 6 +-- internal/cli/cmd/cluster/register.go | 8 ++-- internal/cli/cmd/cluster/register_test.go | 6 +-- internal/cli/cmd/cluster/update.go | 4 +- internal/cli/cmd/cluster/update_test.go | 6 +-- .../clusterdefinition/clusterdefinition.go | 6 +-- .../clusterdefinition_test.go | 6 +-- .../cli/cmd/clusterdefinition/describe.go | 6 +-- .../clusterdefinition/list_component_test.go | 6 +-- .../cmd/clusterdefinition/list_components.go | 4 +- .../cli/cmd/clusterversion/clusterversion.go | 6 +-- .../cmd/clusterversion/clusterversion_test.go | 6 +-- .../cli/cmd/clusterversion/set_default.go | 10 ++--- .../cmd/clusterversion/set_default_test.go | 36 +++++++++--------- internal/cli/cmd/context/cloud_context.go | 4 +- internal/cli/cmd/context/context.go | 14 +++---- internal/cli/cmd/context/context_text.go | 8 ++-- internal/cli/cmd/dashboard/dashboard.go | 18 ++++----- internal/cli/cmd/dashboard/dashboard_test.go | 6 +-- internal/cli/cmd/dataprotection/backup.go | 10 ++--- .../cli/cmd/dataprotection/dataprotection.go | 4 +- internal/cli/cmd/dataprotection/restore.go | 4 +- internal/cli/cmd/fault/fault.go | 4 +- internal/cli/cmd/fault/fault_dns.go | 10 ++--- internal/cli/cmd/fault/fault_dns_test.go | 6 +-- internal/cli/cmd/fault/fault_http.go | 14 +++---- internal/cli/cmd/fault/fault_http_test.go | 6 +-- internal/cli/cmd/fault/fault_io.go | 14 +++---- internal/cli/cmd/fault/fault_io_test.go | 6 +-- internal/cli/cmd/fault/fault_network.go | 18 ++++----- internal/cli/cmd/fault/fault_network_test.go | 6 +-- internal/cli/cmd/fault/fault_node.go | 12 +++--- internal/cli/cmd/fault/fault_node_test.go | 6 +-- internal/cli/cmd/fault/fault_pod.go | 12 +++--- internal/cli/cmd/fault/fault_pod_test.go | 6 +-- internal/cli/cmd/fault/fault_stress.go | 6 +-- internal/cli/cmd/fault/fault_stress_test.go | 6 +-- internal/cli/cmd/fault/fault_time.go | 6 +-- internal/cli/cmd/fault/fault_time_test.go | 6 +-- internal/cli/cmd/fault/list_and_delete.go | 8 ++-- .../cli/cmd/fault/list_and_delete_test.go | 6 +-- internal/cli/cmd/infrastructure/cluster.go | 4 +- internal/cli/cmd/infrastructure/create.go | 4 +- .../cli/cmd/infrastructure/create_test.go | 6 +-- internal/cli/cmd/infrastructure/delete.go | 4 +- internal/cli/cmd/infrastructure/infras.go | 4 +- .../cli/cmd/infrastructure/infras_test.go | 6 +-- internal/cli/cmd/kubeblocks/compare.go | 4 +- internal/cli/cmd/kubeblocks/compare_test.go | 7 ++-- internal/cli/cmd/kubeblocks/config.go | 6 +-- internal/cli/cmd/kubeblocks/config_test.go | 6 +-- internal/cli/cmd/kubeblocks/install.go | 6 +-- internal/cli/cmd/kubeblocks/install_test.go | 8 ++-- internal/cli/cmd/kubeblocks/kubeblocks.go | 4 +- .../cli/cmd/kubeblocks/kubeblocks_test.go | 7 ++-- internal/cli/cmd/kubeblocks/list_versions.go | 6 +-- .../cli/cmd/kubeblocks/list_versions_test.go | 6 +-- internal/cli/cmd/kubeblocks/preflight.go | 6 +-- internal/cli/cmd/kubeblocks/preflight_test.go | 6 +-- internal/cli/cmd/kubeblocks/status.go | 6 +-- internal/cli/cmd/kubeblocks/status_test.go | 6 +-- internal/cli/cmd/kubeblocks/uninstall.go | 4 +- internal/cli/cmd/kubeblocks/uninstall_test.go | 6 +-- internal/cli/cmd/kubeblocks/upgrade.go | 4 +- internal/cli/cmd/kubeblocks/upgrade_test.go | 6 +-- internal/cli/cmd/migration/cmd_builder.go | 4 +- .../cli/cmd/migration/cmd_builder_test.go | 5 +-- internal/cli/cmd/migration/create.go | 4 +- internal/cli/cmd/migration/create_test.go | 6 +-- internal/cli/cmd/migration/describe.go | 8 ++-- internal/cli/cmd/migration/describe_test.go | 4 +- internal/cli/cmd/migration/list.go | 4 +- internal/cli/cmd/migration/list_test.go | 4 +- internal/cli/cmd/migration/logs.go | 4 +- internal/cli/cmd/migration/logs_test.go | 4 +- internal/cli/cmd/migration/templates.go | 4 +- internal/cli/cmd/migration/templates_test.go | 4 +- internal/cli/cmd/migration/terminate.go | 4 +- internal/cli/cmd/migration/terminate_test.go | 4 +- internal/cli/cmd/organization/organization.go | 16 ++++---- .../cli/cmd/organization/organization_test.go | 8 ++-- internal/cli/cmd/playground/destroy.go | 38 ++++++++++--------- internal/cli/cmd/playground/destroy_test.go | 6 +-- internal/cli/cmd/playground/init.go | 8 ++-- internal/cli/cmd/playground/init_test.go | 6 +-- internal/cli/cmd/playground/palyground.go | 4 +- .../cli/cmd/playground/playground_test.go | 6 +-- internal/cli/cmd/playground/util.go | 2 +- internal/cli/cmd/plugin/describe.go | 4 +- internal/cli/cmd/plugin/index.go | 14 +++---- internal/cli/cmd/plugin/install.go | 6 +-- internal/cli/cmd/plugin/plugin.go | 8 ++-- internal/cli/cmd/plugin/plugin_test.go | 8 ++-- internal/cli/cmd/plugin/search.go | 6 +-- internal/cli/cmd/plugin/uninstall.go | 4 +- internal/cli/cmd/plugin/upgrade.go | 6 +-- internal/cli/cmd/report/report.go | 15 ++++---- internal/cli/cmd/report/report_test.go | 14 +++---- internal/cli/create/create.go | 7 ++-- internal/cli/create/create_test.go | 6 +-- internal/cli/delete/delete.go | 6 +-- internal/cli/delete/delete_test.go | 6 +-- internal/cli/edit/custom_edit.go | 7 ++-- internal/cli/edit/custom_edit_test.go | 6 +-- internal/cli/edit/edit.go | 4 +- internal/cli/edit/edit_test.go | 4 +- internal/cli/exec/exec.go | 4 +- internal/cli/exec/exec_test.go | 4 +- internal/cli/list/list.go | 7 ++-- internal/cli/list/list_test.go | 12 +++--- internal/cli/patch/patch.go | 5 ++- internal/cli/patch/patch_test.go | 7 ++-- internal/cli/util/completion.go | 4 +- internal/cli/util/completion_test.go | 6 +-- internal/cli/util/flags/flags_test.go | 4 +- internal/preflight/collect_test.go | 4 +- internal/preflight/text_results_test.go | 5 ++- lorry/middleware/probe/router.go | 5 ++- 209 files changed, 705 insertions(+), 689 deletions(-) diff --git a/internal/cli/cmd/accounts/base.go b/internal/cli/cmd/accounts/base.go index 00d4cb85f11..0366a71e15b 100644 --- a/internal/cli/cmd/accounts/base.go +++ b/internal/cli/cmd/accounts/base.go @@ -27,7 +27,7 @@ import ( "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -61,7 +61,7 @@ var ( errClusterNameorInstName = fmt.Errorf("specify either cluster name or --instance") ) -func NewAccountBaseOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, op lorryutil.OperationKind) *AccountBaseOptions { +func NewAccountBaseOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, op lorryutil.OperationKind) *AccountBaseOptions { return &AccountBaseOptions{ ExecOptions: exec.NewExecOptions(f, streams), AccountOp: op, @@ -147,7 +147,7 @@ func (o *AccountBaseOptions) Complete(f cmdutil.Factory) error { return nil } -func (o *AccountBaseOptions) Run(cmd *cobra.Command, f cmdutil.Factory, streams genericclioptions.IOStreams) error { +func (o *AccountBaseOptions) Run(cmd *cobra.Command, f cmdutil.Factory, streams genericiooptions.IOStreams) error { var err error response, err := o.Do() if err != nil { diff --git a/internal/cli/cmd/accounts/base_test.go b/internal/cli/cmd/accounts/base_test.go index a266f56f015..81876d4a121 100644 --- a/internal/cli/cmd/accounts/base_test.go +++ b/internal/cli/cmd/accounts/base_test.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -44,14 +44,14 @@ var _ = Describe("Base Account Options", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/accounts/create.go b/internal/cli/cmd/accounts/create.go index 334b88e101a..9b6a651082a 100644 --- a/internal/cli/cmd/accounts/create.go +++ b/internal/cli/cmd/accounts/create.go @@ -22,7 +22,7 @@ package accounts import ( "github.com/sethvargo/go-password/password" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" lorryutil "github.com/apecloud/kubeblocks/lorry/util" @@ -33,7 +33,7 @@ type CreateUserOptions struct { info lorryutil.UserInfo } -func NewCreateUserOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *CreateUserOptions { +func NewCreateUserOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *CreateUserOptions { return &CreateUserOptions{ AccountBaseOptions: NewAccountBaseOptions(f, streams, lorryutil.CreateUserOp), } diff --git a/internal/cli/cmd/accounts/create_test.go b/internal/cli/cmd/accounts/create_test.go index 5ee75d7c986..2d72fd9e193 100644 --- a/internal/cli/cmd/accounts/create_test.go +++ b/internal/cli/cmd/accounts/create_test.go @@ -24,9 +24,10 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -44,14 +45,14 @@ var _ = Describe("Create Account Options", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/accounts/delete.go b/internal/cli/cmd/accounts/delete.go index 05b2a7e8b2a..fdc0bb6affd 100644 --- a/internal/cli/cmd/accounts/delete.go +++ b/internal/cli/cmd/accounts/delete.go @@ -21,7 +21,7 @@ package accounts import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "github.com/apecloud/kubeblocks/internal/cli/util/prompt" @@ -34,7 +34,7 @@ type DeleteUserOptions struct { info lorryutil.UserInfo } -func NewDeleteUserOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *DeleteUserOptions { +func NewDeleteUserOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *DeleteUserOptions { return &DeleteUserOptions{ AccountBaseOptions: NewAccountBaseOptions(f, streams, lorryutil.DeleteUserOp), } diff --git a/internal/cli/cmd/accounts/delete_test.go b/internal/cli/cmd/accounts/delete_test.go index 1d9d06cd19a..b63e72385ac 100644 --- a/internal/cli/cmd/accounts/delete_test.go +++ b/internal/cli/cmd/accounts/delete_test.go @@ -27,7 +27,7 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -45,7 +45,7 @@ var _ = Describe("Delete Account Options", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams in *bytes.Buffer tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) @@ -53,7 +53,7 @@ var _ = Describe("Delete Account Options", func() { ) BeforeEach(func() { - streams, in, _, _ = genericclioptions.NewTestIOStreams() + streams, in, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/accounts/describe.go b/internal/cli/cmd/accounts/describe.go index f6d2dd38c39..25aad7c01b5 100644 --- a/internal/cli/cmd/accounts/describe.go +++ b/internal/cli/cmd/accounts/describe.go @@ -21,7 +21,7 @@ package accounts import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" lorryutil "github.com/apecloud/kubeblocks/lorry/util" @@ -32,7 +32,7 @@ type DescribeUserOptions struct { info lorryutil.UserInfo } -func NewDescribeUserOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *DescribeUserOptions { +func NewDescribeUserOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *DescribeUserOptions { return &DescribeUserOptions{ AccountBaseOptions: NewAccountBaseOptions(f, streams, lorryutil.DescribeUserOp), } diff --git a/internal/cli/cmd/accounts/describe_test.go b/internal/cli/cmd/accounts/describe_test.go index b30b6a823c4..c900601a1da 100644 --- a/internal/cli/cmd/accounts/describe_test.go +++ b/internal/cli/cmd/accounts/describe_test.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -44,14 +44,14 @@ var _ = Describe("Describe Account Options", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/accounts/grant.go b/internal/cli/cmd/accounts/grant.go index 751afc3799e..83d8c6a0f88 100644 --- a/internal/cli/cmd/accounts/grant.go +++ b/internal/cli/cmd/accounts/grant.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "golang.org/x/exp/slices" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -36,7 +36,7 @@ type GrantOptions struct { info lorryutil.UserInfo } -func NewGrantOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, op lorryutil.OperationKind) *GrantOptions { +func NewGrantOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, op lorryutil.OperationKind) *GrantOptions { if (op != lorryutil.GrantUserRoleOp) && (op != lorryutil.RevokeUserRoleOp) { klog.V(1).Infof("invalid operation kind: %s", op) return nil diff --git a/internal/cli/cmd/accounts/grant_test.go b/internal/cli/cmd/accounts/grant_test.go index 1f4e5b70495..c5fea209953 100644 --- a/internal/cli/cmd/accounts/grant_test.go +++ b/internal/cli/cmd/accounts/grant_test.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -44,14 +44,14 @@ var _ = Describe("Grant Account Options", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/accounts/list.go b/internal/cli/cmd/accounts/list.go index aff2acf41e5..fc8c666a31d 100644 --- a/internal/cli/cmd/accounts/list.go +++ b/internal/cli/cmd/accounts/list.go @@ -20,7 +20,7 @@ along with this program. If not, see . package accounts import ( - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" lorryutil "github.com/apecloud/kubeblocks/lorry/util" @@ -30,7 +30,7 @@ type ListUserOptions struct { *AccountBaseOptions } -func NewListUserOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *ListUserOptions { +func NewListUserOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *ListUserOptions { return &ListUserOptions{ AccountBaseOptions: NewAccountBaseOptions(f, streams, lorryutil.ListUsersOp), } diff --git a/internal/cli/cmd/accounts/list_test.go b/internal/cli/cmd/accounts/list_test.go index 813e551a487..1bd722fd19b 100644 --- a/internal/cli/cmd/accounts/list_test.go +++ b/internal/cli/cmd/accounts/list_test.go @@ -24,9 +24,10 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -44,14 +45,14 @@ var _ = Describe("List Account Options", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/addon/addon.go b/internal/cli/cmd/addon/addon.go index 3e4782ee369..c2b2fb727e9 100644 --- a/internal/cli/cmd/addon/addon.go +++ b/internal/cli/cmd/addon/addon.go @@ -37,7 +37,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" discoverycli "k8s.io/client-go/discovery" "k8s.io/client-go/dynamic" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -76,7 +76,7 @@ func (r *addonEnableFlags) useDefault() bool { } type addonCmdOpts struct { - genericclioptions.IOStreams + genericiooptions.IOStreams Factory cmdutil.Factory dynamic dynamic.Interface @@ -90,7 +90,7 @@ type addonCmdOpts struct { } // NewAddonCmd for addon functions -func NewAddonCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewAddonCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "addon COMMAND", Short: "Addon command.", @@ -104,7 +104,7 @@ func NewAddonCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra. return cmd } -func newListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.AddonGVR()) cmd := &cobra.Command{ Use: "list", @@ -120,7 +120,7 @@ func newListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C return cmd } -func newDescribeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newDescribeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &addonCmdOpts{ Options: patch.NewOptions(f, streams, types.AddonGVR()), Factory: f, @@ -142,7 +142,7 @@ func newDescribeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cob return cmd } -func newEnableCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newEnableCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &addonCmdOpts{ Options: patch.NewOptions(f, streams, types.AddonGVR()), Factory: f, @@ -228,7 +228,7 @@ re-enable the addon (More info on how-to resize a PVC: https://kubernetes.io/doc return cmd } -func newDisableCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newDisableCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &addonCmdOpts{ Options: patch.NewOptions(f, streams, types.AddonGVR()), Factory: f, diff --git a/internal/cli/cmd/addon/addon_test.go b/internal/cli/cmd/addon/addon_test.go index 7dfd321cd1f..57a88d21769 100644 --- a/internal/cli/cmd/addon/addon_test.go +++ b/internal/cli/cmd/addon/addon_test.go @@ -27,7 +27,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/dynamic/fake" "k8s.io/client-go/kubernetes/scheme" @@ -44,11 +44,11 @@ const ( ) var _ = Describe("Manage applications related to KubeBlocks", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testNamespace) }) diff --git a/internal/cli/cmd/alert/add_receiver.go b/internal/cli/cmd/alert/add_receiver.go index 1a120932c01..3e74eeec210 100644 --- a/internal/cli/cmd/alert/add_receiver.go +++ b/internal/cli/cmd/alert/add_receiver.go @@ -30,7 +30,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -69,7 +69,7 @@ var ( ) type baseOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams alertConfigMap *corev1.ConfigMap webhookConfigMap *corev1.ConfigMap client kubernetes.Interface @@ -90,7 +90,7 @@ type addReceiverOptions struct { webhookAdaptorReceivers []webhookAdaptorReceiver } -func newAddReceiverCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newAddReceiverCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := addReceiverOptions{baseOptions: baseOptions{IOStreams: streams}} cmd := &cobra.Command{ Use: "add-receiver", diff --git a/internal/cli/cmd/alert/add_receiver_test.go b/internal/cli/cmd/alert/add_receiver_test.go index 8b91270e932..d3978d7bf0e 100644 --- a/internal/cli/cmd/alert/add_receiver_test.go +++ b/internal/cli/cmd/alert/add_receiver_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -43,7 +43,7 @@ var mockConfigmap = func(name string, key string, value string) *corev1.ConfigMa return cm } -var mockBaseOptions = func(s genericclioptions.IOStreams) baseOptions { +var mockBaseOptions = func(s genericiooptions.IOStreams) baseOptions { o := baseOptions{IOStreams: s} alertManagerConfig := ` global: @@ -84,12 +84,12 @@ var mockBaseOptions = func(s genericclioptions.IOStreams) baseOptions { var _ = Describe("add receiver", func() { var f *cmdtesting.TestFactory - var s genericclioptions.IOStreams + var s genericiooptions.IOStreams BeforeEach(func() { f = cmdtesting.NewTestFactory() f.Client = &clientfake.RESTClient{} - s, _, _, _ = genericclioptions.NewTestIOStreams() + s, _, _, _ = genericiooptions.NewTestIOStreams() }) AfterEach(func() { diff --git a/internal/cli/cmd/alert/alert_test.go b/internal/cli/cmd/alert/alert_test.go index c4814f3508b..a0da6041086 100644 --- a/internal/cli/cmd/alert/alert_test.go +++ b/internal/cli/cmd/alert/alert_test.go @@ -23,13 +23,13 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("alter", func() { f := cmdtesting.NewTestFactory() - s, _, _, _ := genericclioptions.NewTestIOStreams() + s, _, _, _ := genericiooptions.NewTestIOStreams() defer f.Cleanup() It("create new alert cmd", func() { diff --git a/internal/cli/cmd/alert/alter.go b/internal/cli/cmd/alert/alter.go index 7d4b8c48a7b..cba6078972c 100644 --- a/internal/cli/cmd/alert/alter.go +++ b/internal/cli/cmd/alert/alter.go @@ -21,11 +21,11 @@ package alert import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" ) -func NewAlertCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewAlertCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "alert [add-receiver|list-receivers|delete-receiver]", Short: "Manage alert receiver, include add, list and delete receiver.", diff --git a/internal/cli/cmd/alert/config_smtpserver.go b/internal/cli/cmd/alert/config_smtpserver.go index a54d0e8a84f..885c3fb0d2a 100644 --- a/internal/cli/cmd/alert/config_smtpserver.go +++ b/internal/cli/cmd/alert/config_smtpserver.go @@ -23,7 +23,7 @@ import ( "fmt" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" ) @@ -44,7 +44,7 @@ type configSMTPServerOptions struct { baseOptions } -func newConfigSMTPServerCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newConfigSMTPServerCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &configSMTPServerOptions{baseOptions: baseOptions{IOStreams: streams}} cmd := &cobra.Command{ Use: "config-smtpserver", diff --git a/internal/cli/cmd/alert/config_smtpserver_test.go b/internal/cli/cmd/alert/config_smtpserver_test.go index 7ab7475cf59..0366009f804 100644 --- a/internal/cli/cmd/alert/config_smtpserver_test.go +++ b/internal/cli/cmd/alert/config_smtpserver_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "github.com/apecloud/kubeblocks/internal/cli/testing" ) -var mockBaseOptionsWithoutGlobal = func(s genericclioptions.IOStreams) baseOptions { +var mockBaseOptionsWithoutGlobal = func(s genericiooptions.IOStreams) baseOptions { o := baseOptions{IOStreams: s} alertManagerConfig := ` receivers: @@ -65,12 +65,12 @@ var mockBaseOptionsWithoutGlobal = func(s genericclioptions.IOStreams) baseOptio var _ = Describe("config smtpserver", func() { var f *cmdtesting.TestFactory - var s genericclioptions.IOStreams + var s genericiooptions.IOStreams BeforeEach(func() { f = cmdtesting.NewTestFactory() f.Client = &clientfake.RESTClient{} - s, _, _, _ = genericclioptions.NewTestIOStreams() + s, _, _, _ = genericiooptions.NewTestIOStreams() }) AfterEach(func() { diff --git a/internal/cli/cmd/alert/delete_receiver.go b/internal/cli/cmd/alert/delete_receiver.go index b71663739e8..5be70456ef0 100644 --- a/internal/cli/cmd/alert/delete_receiver.go +++ b/internal/cli/cmd/alert/delete_receiver.go @@ -24,7 +24,7 @@ import ( "strings" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -43,7 +43,7 @@ type deleteReceiverOptions struct { names []string } -func newDeleteReceiverCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newDeleteReceiverCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &deleteReceiverOptions{baseOptions: baseOptions{IOStreams: streams}} cmd := &cobra.Command{ Use: "delete-receiver NAME", diff --git a/internal/cli/cmd/alert/delete_receiver_test.go b/internal/cli/cmd/alert/delete_receiver_test.go index bdc5d4f08f4..30a14af5dd2 100644 --- a/internal/cli/cmd/alert/delete_receiver_test.go +++ b/internal/cli/cmd/alert/delete_receiver_test.go @@ -23,9 +23,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" - - "k8s.io/cli-runtime/pkg/genericclioptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "github.com/apecloud/kubeblocks/internal/cli/testing" @@ -33,12 +32,12 @@ import ( var _ = Describe("alert", func() { var f *cmdtesting.TestFactory - var s genericclioptions.IOStreams + var s genericiooptions.IOStreams BeforeEach(func() { f = cmdtesting.NewTestFactory() f.Client = &clientfake.RESTClient{} - s, _, _, _ = genericclioptions.NewTestIOStreams() + s, _, _, _ = genericiooptions.NewTestIOStreams() }) AfterEach(func() { diff --git a/internal/cli/cmd/alert/list_receivers.go b/internal/cli/cmd/alert/list_receivers.go index 56f423665e7..86c79a4f594 100644 --- a/internal/cli/cmd/alert/list_receivers.go +++ b/internal/cli/cmd/alert/list_receivers.go @@ -25,7 +25,7 @@ import ( "github.com/mitchellh/mapstructure" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -43,7 +43,7 @@ type listReceiversOptions struct { baseOptions } -func newListReceiversCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newListReceiversCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &listReceiversOptions{baseOptions: baseOptions{IOStreams: streams}} cmd := &cobra.Command{ Use: "list-receivers", diff --git a/internal/cli/cmd/alert/list_receivers_test.go b/internal/cli/cmd/alert/list_receivers_test.go index e202811c3d4..8a066a853f3 100644 --- a/internal/cli/cmd/alert/list_receivers_test.go +++ b/internal/cli/cmd/alert/list_receivers_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" clientfake "k8s.io/client-go/rest/fake" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "github.com/apecloud/kubeblocks/internal/cli/testing" @@ -32,12 +32,12 @@ import ( var _ = Describe("alert", func() { var f *cmdtesting.TestFactory - var s genericclioptions.IOStreams + var s genericiooptions.IOStreams BeforeEach(func() { f = cmdtesting.NewTestFactory() f.Client = &clientfake.RESTClient{} - s, _, _, _ = genericclioptions.NewTestIOStreams() + s, _, _, _ = genericiooptions.NewTestIOStreams() }) AfterEach(func() { diff --git a/internal/cli/cmd/alert/list_smtpserver.go b/internal/cli/cmd/alert/list_smtpserver.go index 4c9d6c16ceb..8fd32f26ef9 100644 --- a/internal/cli/cmd/alert/list_smtpserver.go +++ b/internal/cli/cmd/alert/list_smtpserver.go @@ -21,7 +21,7 @@ package alert import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -39,7 +39,7 @@ type listSMTPServerOptions struct { baseOptions } -func newListSMTPServerCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newListSMTPServerCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &listSMTPServerOptions{baseOptions: baseOptions{IOStreams: streams}} cmd := &cobra.Command{ Use: "list-smtpserver", diff --git a/internal/cli/cmd/alert/list_smtpserver_test.go b/internal/cli/cmd/alert/list_smtpserver_test.go index 1146c22a8f0..d94146d4e50 100644 --- a/internal/cli/cmd/alert/list_smtpserver_test.go +++ b/internal/cli/cmd/alert/list_smtpserver_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -32,12 +32,12 @@ import ( var _ = Describe("list smtpserver", func() { var f *cmdtesting.TestFactory - var s genericclioptions.IOStreams + var s genericiooptions.IOStreams BeforeEach(func() { f = cmdtesting.NewTestFactory() f.Client = &clientfake.RESTClient{} - s, _, _, _ = genericclioptions.NewTestIOStreams() + s, _, _, _ = genericiooptions.NewTestIOStreams() }) AfterEach(func() { diff --git a/internal/cli/cmd/auth/authorize/issued_provider.go b/internal/cli/cmd/auth/authorize/issued_provider.go index 3a150a6f13d..b807103ef96 100644 --- a/internal/cli/cmd/auth/authorize/issued_provider.go +++ b/internal/cli/cmd/auth/authorize/issued_provider.go @@ -30,7 +30,7 @@ import ( "github.com/briandowns/spinner" "github.com/hashicorp/go-cleanhttp" "github.com/pkg/errors" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/cmd/auth/authorize/authenticator" "github.com/apecloud/kubeblocks/internal/cli/cmd/auth/utils" @@ -42,7 +42,7 @@ type Options struct { ClientID string `json:"client_id"` AuthURL string NoBrowser bool - genericclioptions.IOStreams + genericiooptions.IOStreams } type CloudIssuedTokenProvider struct { diff --git a/internal/cli/cmd/auth/authorize/issued_provoder_test.go b/internal/cli/cmd/auth/authorize/issued_provoder_test.go index 89e578e4e65..975f1aab1e0 100644 --- a/internal/cli/cmd/auth/authorize/issued_provoder_test.go +++ b/internal/cli/cmd/auth/authorize/issued_provoder_test.go @@ -26,7 +26,7 @@ import ( "context" "fmt" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/cmd/auth/authorize/authenticator" ) @@ -91,12 +91,12 @@ var _ = Describe("issued provider", func() { issuedTokenProvider *CloudIssuedTokenProvider tokenRes *authenticator.TokenResponse o Options - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { mockAuthenticator = NewMockAuthenticator() - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() o = Options{ ClientID: "test_client_id", AuthURL: "test_auth_url", diff --git a/internal/cli/cmd/auth/login.go b/internal/cli/cmd/auth/login.go index 45e88be690d..df0479ec352 100644 --- a/internal/cli/cmd/auth/login.go +++ b/internal/cli/cmd/auth/login.go @@ -28,11 +28,11 @@ import ( "net/url" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/cmd/auth/authorize" "github.com/apecloud/kubeblocks/internal/cli/cmd/auth/utils" - cloud_context "github.com/apecloud/kubeblocks/internal/cli/cmd/context" + cloudctx "github.com/apecloud/kubeblocks/internal/cli/cmd/context" "github.com/apecloud/kubeblocks/internal/cli/cmd/organization" ) @@ -49,7 +49,7 @@ type LoginOptions struct { Provider authorize.Provider } -func NewLogin(streams genericclioptions.IOStreams) *cobra.Command { +func NewLogin(streams genericiooptions.IOStreams) *cobra.Command { o := &LoginOptions{Options: authorize.Options{IOStreams: streams}} cmd := &cobra.Command{ Use: "login", @@ -240,7 +240,7 @@ func getFirstOrg(token string) string { } func getFirstContext(token string, orgName string) string { - c := &cloud_context.CloudContext{ + c := &cloudctx.CloudContext{ OrgName: orgName, Token: token, APIURL: organization.APIURL, diff --git a/internal/cli/cmd/auth/logout.go b/internal/cli/cmd/auth/logout.go index 8acb7db5f9d..5a9bdafee5a 100644 --- a/internal/cli/cmd/auth/logout.go +++ b/internal/cli/cmd/auth/logout.go @@ -26,7 +26,7 @@ import ( "io" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/cmd/auth/authorize" "github.com/apecloud/kubeblocks/internal/cli/cmd/auth/utils" @@ -39,7 +39,7 @@ type LogOutOptions struct { Provider authorize.Provider } -func NewLogout(streams genericclioptions.IOStreams) *cobra.Command { +func NewLogout(streams genericiooptions.IOStreams) *cobra.Command { o := &LogOutOptions{Options: authorize.Options{IOStreams: streams}} cmd := &cobra.Command{ Use: "logout", diff --git a/internal/cli/cmd/backuprepo/backuprepo.go b/internal/cli/cmd/backuprepo/backuprepo.go index 8855748bc56..64daaf64739 100644 --- a/internal/cli/cmd/backuprepo/backuprepo.go +++ b/internal/cli/cmd/backuprepo/backuprepo.go @@ -21,11 +21,11 @@ package backuprepo import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" ) -func NewBackupRepoCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewBackupRepoCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "backuprepo COMMAND", Short: "BackupRepo command.", diff --git a/internal/cli/cmd/backuprepo/backuprepo_test.go b/internal/cli/cmd/backuprepo/backuprepo_test.go index da29ce70358..baa4dbb078d 100644 --- a/internal/cli/cmd/backuprepo/backuprepo_test.go +++ b/internal/cli/cmd/backuprepo/backuprepo_test.go @@ -22,16 +22,16 @@ package backuprepo import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("backuprepo command", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory() }) diff --git a/internal/cli/cmd/backuprepo/create.go b/internal/cli/cmd/backuprepo/create.go index ba4d42ec419..fa131bd465d 100644 --- a/internal/cli/cmd/backuprepo/create.go +++ b/internal/cli/cmd/backuprepo/create.go @@ -32,7 +32,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" k8stypes "k8s.io/apimachinery/pkg/types" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/kube-openapi/pkg/validation/spec" @@ -65,7 +65,7 @@ var ( ) type createOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams dynamic dynamic.Interface client kubernetes.Interface factory cmdutil.Factory @@ -100,7 +100,7 @@ var backupRepoCreateExamples = templates.Examples(` --secret-access-key `) -func newCreateCommand(o *createOptions, f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newCreateCommand(o *createOptions, f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { if o == nil { o = &createOptions{} } diff --git a/internal/cli/cmd/backuprepo/create_test.go b/internal/cli/cmd/backuprepo/create_test.go index 17c9f28f604..045d0204f94 100644 --- a/internal/cli/cmd/backuprepo/create_test.go +++ b/internal/cli/cmd/backuprepo/create_test.go @@ -27,11 +27,12 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/spf13/cobra" "github.com/spf13/pflag" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/dynamic/fake" clientfake "k8s.io/client-go/rest/fake" @@ -42,13 +43,13 @@ import ( ) var _ = Describe("backuprepo create command", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory var cmd *cobra.Command var options *createOptions BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/backuprepo/describe.go b/internal/cli/cmd/backuprepo/describe.go index dba6d0d0566..918e3451e71 100644 --- a/internal/cli/cmd/backuprepo/describe.go +++ b/internal/cli/cmd/backuprepo/describe.go @@ -28,7 +28,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -57,10 +57,10 @@ type describeBackupRepoOptions struct { gvr schema.GroupVersionResource names []string - genericclioptions.IOStreams + genericiooptions.IOStreams } -func newDescribeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newDescribeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &describeBackupRepoOptions{ factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/backuprepo/list.go b/internal/cli/cmd/backuprepo/list.go index 8209d5a08a5..4842ed59cd9 100644 --- a/internal/cli/cmd/backuprepo/list.go +++ b/internal/cli/cmd/backuprepo/list.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -50,7 +50,7 @@ type listBackupRepoOptions struct { *list.ListOptions } -func newListCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newListCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &listBackupRepoOptions{ ListOptions: list.NewListOptions(f, streams, types.BackupRepoGVR()), } diff --git a/internal/cli/cmd/bench/bench.go b/internal/cli/cmd/bench/bench.go index 73f0e5be5fe..9a12be4b423 100644 --- a/internal/cli/cmd/bench/bench.go +++ b/internal/cli/cmd/bench/bench.go @@ -32,7 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" @@ -93,7 +93,7 @@ type BenchBaseOptions struct { client clientset.Interface dynamic dynamic.Interface *cluster.ClusterObjects - genericclioptions.IOStreams + genericiooptions.IOStreams } func (o *BenchBaseOptions) BaseComplete() error { @@ -151,7 +151,7 @@ func (o *BenchBaseOptions) AddFlags(cmd *cobra.Command) { } // NewBenchCmd creates the bench command -func NewBenchCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewBenchCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "bench", Short: "Run a benchmark.", @@ -178,7 +178,7 @@ type benchListOption struct { Format string AllNamespaces bool - genericclioptions.IOStreams + genericiooptions.IOStreams } type benchDeleteOption struct { @@ -187,7 +187,7 @@ type benchDeleteOption struct { dynamic dynamic.Interface namespace string - genericclioptions.IOStreams + genericiooptions.IOStreams } type benchDescribeOption struct { @@ -197,10 +197,10 @@ type benchDescribeOption struct { namespace string benchs []string - genericclioptions.IOStreams + genericiooptions.IOStreams } -func newListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &benchListOption{ Factory: f, IOStreams: streams, @@ -222,7 +222,7 @@ func newListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C return cmd } -func newDeleteCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newDeleteCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &benchDeleteOption{ factory: f, IOStreams: streams, @@ -244,7 +244,7 @@ func newDeleteCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra return cmd } -func newDescribeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newDescribeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &benchDescribeOption{ factory: f, IOStreams: streams, @@ -457,7 +457,7 @@ func registerBenchmarkCompletionFunc(cmd *cobra.Command, f cmdutil.Factory, args return benchs, cobra.ShellCompDirectiveNoFileComp } -func validateBenchmarkExist(factory cmdutil.Factory, streams genericclioptions.IOStreams, name string) error { +func validateBenchmarkExist(factory cmdutil.Factory, streams genericiooptions.IOStreams, name string) error { var infos []*resource.Info for _, gvr := range benchGVRList { bench := list.NewListOptions(factory, streams, gvr) diff --git a/internal/cli/cmd/bench/bench_test.go b/internal/cli/cmd/bench/bench_test.go index d4af974b839..d7e98042667 100644 --- a/internal/cli/cmd/bench/bench_test.go +++ b/internal/cli/cmd/bench/bench_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -47,12 +47,12 @@ var _ = Describe("bench", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} tf.FakeDynamicClient = testing.FakeDynamicClient() diff --git a/internal/cli/cmd/bench/pgbench.go b/internal/cli/cmd/bench/pgbench.go index eacc348d864..c05ee8ce613 100644 --- a/internal/cli/cmd/bench/pgbench.go +++ b/internal/cli/cmd/bench/pgbench.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -78,7 +78,7 @@ type PgBenchOptions struct { BenchBaseOptions } -func NewPgBenchCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPgBenchCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &PgBenchOptions{ BenchBaseOptions: BenchBaseOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/bench/sysbench.go b/internal/cli/cmd/bench/sysbench.go index 7c310eee601..8ef46ae4367 100644 --- a/internal/cli/cmd/bench/sysbench.go +++ b/internal/cli/cmd/bench/sysbench.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -82,7 +82,7 @@ type SysBenchOptions struct { BenchBaseOptions } -func NewSysBenchCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewSysBenchCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &SysBenchOptions{ BenchBaseOptions: BenchBaseOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/bench/tpcc.go b/internal/cli/cmd/bench/tpcc.go index e97e4542ea7..6ecb1fc80ce 100644 --- a/internal/cli/cmd/bench/tpcc.go +++ b/internal/cli/cmd/bench/tpcc.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -85,7 +85,7 @@ type TpccOptions struct { BenchBaseOptions } -func NewTpccCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewTpccCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &TpccOptions{ BenchBaseOptions: BenchBaseOptions{ factory: f, diff --git a/internal/cli/cmd/bench/tpch.go b/internal/cli/cmd/bench/tpch.go index a7bd56a53f3..26d413d44b7 100644 --- a/internal/cli/cmd/bench/tpch.go +++ b/internal/cli/cmd/bench/tpch.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -55,7 +55,7 @@ type TpchOptions struct { BenchBaseOptions } -func NewTpchCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewTpchCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &TpchOptions{ BenchBaseOptions: BenchBaseOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/bench/ycsb.go b/internal/cli/cmd/bench/ycsb.go index c182e84759a..8f6adefdaab 100644 --- a/internal/cli/cmd/bench/ycsb.go +++ b/internal/cli/cmd/bench/ycsb.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -82,7 +82,7 @@ type YcsbOptions struct { BenchBaseOptions } -func NewYcsbCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewYcsbCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &YcsbOptions{ BenchBaseOptions: BenchBaseOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/builder/builder.go b/internal/cli/cmd/builder/builder.go index cbbce894767..dbf5e6683e0 100644 --- a/internal/cli/cmd/builder/builder.go +++ b/internal/cli/cmd/builder/builder.go @@ -21,7 +21,7 @@ package builder import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "github.com/apecloud/kubeblocks/internal/cli/cmd/builder/template" @@ -29,7 +29,7 @@ import ( ) // NewBuilderCmd for builder functions -func NewBuilderCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewBuilderCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "builder", Short: "builder command.", diff --git a/internal/cli/cmd/builder/builder_test.go b/internal/cli/cmd/builder/builder_test.go index ff8aa23afaf..74276d4dbf9 100644 --- a/internal/cli/cmd/builder/builder_test.go +++ b/internal/cli/cmd/builder/builder_test.go @@ -23,16 +23,16 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("builder", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory() }) diff --git a/internal/cli/cmd/builder/template/template.go b/internal/cli/cmd/builder/template/template.go index d7192d94c4f..87406112f47 100644 --- a/internal/cli/cmd/builder/template/template.go +++ b/internal/cli/cmd/builder/template/template.go @@ -24,7 +24,7 @@ import ( "path/filepath" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -35,7 +35,7 @@ import ( ) type renderTPLCmdOpts struct { - genericclioptions.IOStreams + genericiooptions.IOStreams Factory cmdutil.Factory // dynamic dynamic.Interface @@ -119,7 +119,7 @@ func (o *renderTPLCmdOpts) checkAndHelmTemplate() error { return HelmTemplate(o.helmTemplateDir, o.helmOutputDir) } -func NewComponentTemplateRenderCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewComponentTemplateRenderCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &renderTPLCmdOpts{ Factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/builder/template/template_test.go b/internal/cli/cmd/builder/template/template_test.go index f9965acabcc..957b7e93d3a 100644 --- a/internal/cli/cmd/builder/template/template_test.go +++ b/internal/cli/cmd/builder/template/template_test.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "github.com/apecloud/kubeblocks/internal/cli/testing" @@ -36,11 +36,11 @@ import ( var _ = Describe("template", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory("default") }) diff --git a/internal/cli/cmd/builder/tools/migrate_scripts.go b/internal/cli/cmd/builder/tools/migrate_scripts.go index da5cbbc5fca..866a2b9d4bd 100644 --- a/internal/cli/cmd/builder/tools/migrate_scripts.go +++ b/internal/cli/cmd/builder/tools/migrate_scripts.go @@ -28,7 +28,7 @@ import ( "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" "sigs.k8s.io/controller-runtime/pkg/client" @@ -42,7 +42,7 @@ import ( ) type migrateOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams Factory cmdutil.Factory // dynamic dynamic.Interface @@ -151,7 +151,7 @@ func (o *migrateOptions) buildFlags(cmd *cobra.Command) { var migrateExamples = templates.Examples(` `) -func NewMigrateHelmScriptsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrateHelmScriptsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &migrateOptions{ Factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/class/class.go b/internal/cli/cmd/class/class.go index bde026923bd..e0cbe8744cc 100644 --- a/internal/cli/cmd/class/class.go +++ b/internal/cli/cmd/class/class.go @@ -21,11 +21,11 @@ package class import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" ) -func NewClassCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewClassCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "class", Short: "Manage classes", diff --git a/internal/cli/cmd/class/class_test.go b/internal/cli/cmd/class/class_test.go index c4d92e43a54..6fec251437f 100644 --- a/internal/cli/cmd/class/class_test.go +++ b/internal/cli/cmd/class/class_test.go @@ -23,16 +23,16 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("class", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory() }) diff --git a/internal/cli/cmd/class/create.go b/internal/cli/cmd/class/create.go index 20d2ec86701..46130433962 100644 --- a/internal/cli/cmd/class/create.go +++ b/internal/cli/cmd/class/create.go @@ -33,7 +33,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" cmdutil "k8s.io/kubectl/pkg/cmd/util" utilcomp "k8s.io/kubectl/pkg/util/completion" @@ -47,7 +47,7 @@ import ( ) type CreateOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams // REVIEW: make this field a parameter which can be set by user objectName string @@ -70,7 +70,7 @@ var classCreateExamples = templates.Examples(` kbcli class create --cluster-definition apecloud-mysql --type mysql --file ./classes.yaml `) -func NewCreateCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewCreateCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := CreateOptions{IOStreams: streams} cmd := &cobra.Command{ Use: "create [NAME]", diff --git a/internal/cli/cmd/class/create_test.go b/internal/cli/cmd/class/create_test.go index f5b21933001..b8d7f6a6880 100644 --- a/internal/cli/cmd/class/create_test.go +++ b/internal/cli/cmd/class/create_test.go @@ -25,8 +25,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/cli-runtime/pkg/genericiooptions" - "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/client-go/kubernetes/scheme" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -39,7 +39,7 @@ var _ = Describe("create", func() { createOptions *CreateOptions out *bytes.Buffer tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) fillResources := func(o *CreateOptions, cpu string, memory string) { @@ -49,7 +49,7 @@ var _ = Describe("create", func() { } BeforeEach(func() { - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) _ = appsv1alpha1.AddToScheme(scheme.Scheme) createOptions = &CreateOptions{ diff --git a/internal/cli/cmd/class/list.go b/internal/cli/cmd/class/list.go index e9d01bd9153..0ae71ae9f54 100644 --- a/internal/cli/cmd/class/list.go +++ b/internal/cli/cmd/class/list.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -41,7 +41,7 @@ type ListOptions struct { ClusterDefRef string Factory cmdutil.Factory dynamic dynamic.Interface - genericclioptions.IOStreams + genericiooptions.IOStreams } var listClassExamples = templates.Examples(` @@ -49,7 +49,7 @@ var listClassExamples = templates.Examples(` kbcli class list --cluster-definition apecloud-mysql `) -func NewListCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &ListOptions{IOStreams: streams} cmd := &cobra.Command{ Use: "list", diff --git a/internal/cli/cmd/class/list_test.go b/internal/cli/cmd/class/list_test.go index 4eafeb4d017..c34a4461093 100644 --- a/internal/cli/cmd/class/list_test.go +++ b/internal/cli/cmd/class/list_test.go @@ -25,7 +25,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes/scheme" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -37,11 +37,11 @@ var _ = Describe("list", func() { var ( out *bytes.Buffer tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) _ = appsv1alpha1.AddToScheme(scheme.Scheme) tf.FakeDynamicClient = testing.FakeDynamicClient(&classDef) diff --git a/internal/cli/cmd/class/template.go b/internal/cli/cmd/class/template.go index 8c485aa00c1..8b82b7c10b7 100644 --- a/internal/cli/cmd/class/template.go +++ b/internal/cli/cmd/class/template.go @@ -24,7 +24,7 @@ import ( "os" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/util" ) @@ -49,12 +49,12 @@ const ComponentClassTemplate = ` ` type TemplateOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams outputFile string } -func NewTemplateCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewTemplateCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &TemplateOptions{IOStreams: streams} cmd := &cobra.Command{ Use: "template", diff --git a/internal/cli/cmd/class/template_test.go b/internal/cli/cmd/class/template_test.go index c9ad814e83b..bca75744017 100644 --- a/internal/cli/cmd/class/template_test.go +++ b/internal/cli/cmd/class/template_test.go @@ -25,17 +25,17 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) var _ = Describe("template", func() { var ( out *bytes.Buffer - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() }) It("command should succeed", func() { diff --git a/internal/cli/cmd/cli.go b/internal/cli/cmd/cli.go index 67b30e490c6..1f68f6dffdd 100644 --- a/internal/cli/cmd/cli.go +++ b/internal/cli/cmd/cli.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cliflag "k8s.io/component-base/cli/flag" "k8s.io/klog/v2" kccmd "k8s.io/kubectl/pkg/cmd" @@ -184,7 +184,7 @@ A Command Line Interface for KubeBlocks`, util.AddKlogFlags(flags) f := cmdutil.NewFactory(matchVersionKubeConfigFlags) - ioStreams := genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} + ioStreams := genericiooptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} // Add subcommands cmd.AddCommand( diff --git a/internal/cli/cmd/cluster/accounts.go b/internal/cli/cmd/cluster/accounts.go index 30892419c31..1a242fbee8d 100644 --- a/internal/cli/cmd/cluster/accounts.go +++ b/internal/cli/cmd/cluster/accounts.go @@ -21,7 +21,7 @@ package cluster import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -87,7 +87,7 @@ var ( `) ) -func NewCreateAccountCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewCreateAccountCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := accounts.NewCreateUserOptions(f, streams) cmd := &cobra.Command{ Use: "create-account", @@ -104,7 +104,7 @@ func NewCreateAccountCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) return cmd } -func NewDeleteAccountCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDeleteAccountCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := accounts.NewDeleteUserOptions(f, streams) cmd := &cobra.Command{ Use: "delete-account", @@ -122,7 +122,7 @@ func NewDeleteAccountCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) return cmd } -func NewDescAccountCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescAccountCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := accounts.NewDescribeUserOptions(f, streams) cmd := &cobra.Command{ Use: "describe-account", @@ -139,7 +139,7 @@ func NewDescAccountCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) * return cmd } -func NewListAccountsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListAccountsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := accounts.NewListUserOptions(f, streams) cmd := &cobra.Command{ @@ -158,7 +158,7 @@ func NewListAccountsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) return cmd } -func NewGrantOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewGrantOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := accounts.NewGrantOptions(f, streams, lorryutil.GrantUserRoleOp) cmd := &cobra.Command{ @@ -177,7 +177,7 @@ func NewGrantOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func NewRevokeOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewRevokeOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := accounts.NewGrantOptions(f, streams, lorryutil.RevokeUserRoleOp) cmd := &cobra.Command{ diff --git a/internal/cli/cmd/cluster/cluster.go b/internal/cli/cmd/cluster/cluster.go index 0b2d53f070e..fbec8710870 100644 --- a/internal/cli/cmd/cluster/cluster.go +++ b/internal/cli/cmd/cluster/cluster.go @@ -21,7 +21,7 @@ package cluster import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -37,7 +37,7 @@ func init() { } // NewClusterCmd creates the cluster command -func NewClusterCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewClusterCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "cluster", Short: "Cluster command.", diff --git a/internal/cli/cmd/cluster/cluster_test.go b/internal/cli/cmd/cluster/cluster_test.go index cdce91c0ee1..34b733e8f6d 100644 --- a/internal/cli/cmd/cluster/cluster_test.go +++ b/internal/cli/cmd/cluster/cluster_test.go @@ -27,7 +27,7 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -55,7 +55,7 @@ var _ = Describe("Cluster", func() { clusterName = "test" namespace = "default" ) - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory // test if DEFAULT_STORAGE_CLASS is not set in config.yaml fakeNilConfigData := map[string]string{ @@ -71,7 +71,7 @@ var _ = Describe("Cluster", func() { DEFAULT_STORAGE_CLASS: kb-default-sc`, } BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) cd := testing.FakeClusterDef() fakeDefaultStorageClass := testing.FakeStorageClass(testing.StorageClassName, testing.IsDefault) diff --git a/internal/cli/cmd/cluster/config_diff.go b/internal/cli/cmd/cluster/config_diff.go index 67f3c00ceef..5a6c9b62359 100644 --- a/internal/cli/cmd/cluster/config_diff.go +++ b/internal/cli/cmd/cluster/config_diff.go @@ -25,7 +25,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" "sigs.k8s.io/controller-runtime/pkg/client" @@ -257,7 +257,7 @@ func (o *configDiffOptions) diffConfig(tplName string) ([]core.VisualizedParam, } // NewDiffConfigureCmd shows the difference between two configuration version. -func NewDiffConfigureCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDiffConfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &configDiffOptions{baseOptions: newDescribeOpsOptions(f, streams)} cmd := &cobra.Command{ Use: "diff-config", diff --git a/internal/cli/cmd/cluster/config_edit.go b/internal/cli/cmd/cluster/config_edit.go index 9d70d6cd970..3586e313892 100644 --- a/internal/cli/cmd/cluster/config_edit.go +++ b/internal/cli/cmd/cluster/config_edit.go @@ -29,7 +29,7 @@ import ( "github.com/spf13/cobra" "golang.org/x/exp/slices" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/cmd/util/editor" "k8s.io/kubectl/pkg/util/templates" @@ -223,7 +223,7 @@ func (o *editConfigOptions) getReaderWrapper() (io.Reader, error) { } // NewEditConfigureCmd shows the difference between two configuration version. -func NewEditConfigureCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewEditConfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &editConfigOptions{ configOpsOptions: configOpsOptions{ editMode: true, diff --git a/internal/cli/cmd/cluster/config_observer.go b/internal/cli/cmd/cluster/config_observer.go index 4c388209047..784973f19b6 100644 --- a/internal/cli/cmd/cluster/config_observer.go +++ b/internal/cli/cmd/cluster/config_observer.go @@ -30,7 +30,7 @@ import ( apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -376,7 +376,7 @@ func isDynamicType(pt *parameterSchema, staticParameters, dynamicParameters *cfg } // NewDescribeReconfigureCmd shows details of history modifications or configuration file of reconfiguring operations -func NewDescribeReconfigureCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescribeReconfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &configObserverOptions{ isExplain: false, showDetail: false, @@ -400,7 +400,7 @@ func NewDescribeReconfigureCmd(f cmdutil.Factory, streams genericclioptions.IOSt } // NewExplainReconfigureCmd shows details of modifiable parameters. -func NewExplainReconfigureCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewExplainReconfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &configObserverOptions{ isExplain: true, truncEnum: true, diff --git a/internal/cli/cmd/cluster/config_ops.go b/internal/cli/cmd/cluster/config_ops.go index c6253ae82e2..bab110d3c71 100644 --- a/internal/cli/cmd/cluster/config_ops.go +++ b/internal/cli/cmd/cluster/config_ops.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" "sigs.k8s.io/controller-runtime/pkg/client" @@ -247,7 +247,7 @@ func (o *configOpsOptions) buildReconfigureCommonFlags(cmd *cobra.Command, f cmd } // NewReconfigureCmd creates a Reconfiguring command -func NewReconfigureCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewReconfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &configOpsOptions{ editMode: false, OperationsOptions: newBaseOperationsOptions(f, streams, appsv1alpha1.ReconfiguringType, false), diff --git a/internal/cli/cmd/cluster/config_ops_test.go b/internal/cli/cmd/cluster/config_ops_test.go index 179c1fad15b..fba17abced9 100644 --- a/internal/cli/cmd/cluster/config_ops_test.go +++ b/internal/cli/cmd/cluster/config_ops_test.go @@ -30,7 +30,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -45,13 +45,13 @@ var _ = Describe("reconfigure test", func() { clusterName1 = "cluster-ops1" ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory in *bytes.Buffer ) BeforeEach(func() { - streams, in, _, _ = genericclioptions.NewTestIOStreams() + streams, in, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) clusterWithTwoComps := testing.FakeCluster(clusterName, testing.Namespace) clusterWithOneComp := clusterWithTwoComps.DeepCopy() diff --git a/internal/cli/cmd/cluster/config_util_test.go b/internal/cli/cmd/cluster/config_util_test.go index 05c76c604f2..2373bef8680 100644 --- a/internal/cli/cmd/cluster/config_util_test.go +++ b/internal/cli/cmd/cluster/config_util_test.go @@ -22,7 +22,7 @@ package cluster import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" dynamicfakeclient "k8s.io/client-go/dynamic/fake" "k8s.io/client-go/kubernetes/scheme" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -33,7 +33,7 @@ import ( ) func NewFakeOperationsOptions(ns, cName string, opsType appsv1alpha1.OpsType, objs ...runtime.Object) (*cmdtesting.TestFactory, *create.CreateOptions) { - streams, _, _, _ := genericclioptions.NewTestIOStreams() + streams, _, _, _ := genericiooptions.NewTestIOStreams() tf := cmdtesting.NewTestFactory().WithNamespace(ns) baseOptions := &create.CreateOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/cluster/connect.go b/internal/cli/cmd/cluster/connect.go index 2620cb143f1..a85a0eddad8 100644 --- a/internal/cli/cmd/cluster/connect.go +++ b/internal/cli/cmd/cluster/connect.go @@ -29,7 +29,7 @@ import ( "golang.org/x/crypto/ssh/terminal" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -95,7 +95,7 @@ type ConnectOptions struct { } // NewConnectCmd returns the cmd of connecting to a cluster -func NewConnectCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewConnectCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &ConnectOptions{ExecOptions: exec.NewExecOptions(f, streams)} cmd := &cobra.Command{ Use: "connect (NAME | -i INSTANCE-NAME)", diff --git a/internal/cli/cmd/cluster/connect_test.go b/internal/cli/cmd/cluster/connect_test.go index e2148adb834..716fdc858c6 100644 --- a/internal/cli/cmd/cluster/connect_test.go +++ b/internal/cli/cmd/cluster/connect_test.go @@ -24,11 +24,12 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -46,7 +47,7 @@ var _ = Describe("connection", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) @@ -74,7 +75,7 @@ var _ = Describe("connection", func() { tf.Client = tf.UnstructuredClient tf.FakeDynamicClient = testing.FakeDynamicClient(cluster, testing.FakeClusterDef(), testing.FakeClusterVersion()) - streams = genericclioptions.NewTestIOStreamsDiscard() + streams = genericiooptions.NewTestIOStreamsDiscard() }) AfterEach(func() { diff --git a/internal/cli/cmd/cluster/create.go b/internal/cli/cmd/cluster/create.go index f36bf19f605..c8590c9e860 100755 --- a/internal/cli/cmd/cluster/create.go +++ b/internal/cli/cmd/cluster/create.go @@ -42,7 +42,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" corev1ac "k8s.io/client-go/applyconfigurations/core/v1" rbacv1ac "k8s.io/client-go/applyconfigurations/rbac/v1" "k8s.io/client-go/dynamic" @@ -242,7 +242,7 @@ type CreateOptions struct { create.CreateOptions `json:"-"` } -func NewCreateCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewCreateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewCreateOptions(f, streams) cmd := &cobra.Command{ Use: "create [NAME]", @@ -287,7 +287,7 @@ func NewCreateCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra return cmd } -func NewCreateOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *CreateOptions { +func NewCreateOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *CreateOptions { o := &CreateOptions{CreateOptions: create.CreateOptions{ Factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/cluster/create_subcmds_test.go b/internal/cli/cmd/cluster/create_subcmds_test.go index 3968704f995..d8b60549133 100644 --- a/internal/cli/cmd/cluster/create_subcmds_test.go +++ b/internal/cli/cmd/cluster/create_subcmds_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/version" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/kubernetes/scheme" @@ -52,7 +52,7 @@ var _ = Describe("create cluster by cluster type", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams createOptions *create.CreateOptions mockClient = func(data runtime.Object) *cmdtesting.TestFactory { tf = testing.NewTestFactory(testing.Namespace) @@ -72,7 +72,7 @@ var _ = Describe("create cluster by cluster type", func() { BeforeEach(func() { _ = appsv1alpha1.AddToScheme(scheme.Scheme) _ = metav1.AddMetaToScheme(scheme.Scheme) - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = mockClient(testing.FakeClusterVersion()) createOptions = &create.CreateOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/cluster/create_test.go b/internal/cli/cmd/cluster/create_test.go index fc0ff5ce74c..eb3f05d7a05 100644 --- a/internal/cli/cmd/cluster/create_test.go +++ b/internal/cli/cmd/cluster/create_test.go @@ -32,7 +32,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/util/json" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" appsv1alpha1 "github.com/apecloud/kubeblocks/apis/apps/v1alpha1" "github.com/apecloud/kubeblocks/apis/dataprotection/v1alpha1" @@ -119,7 +119,7 @@ var _ = Describe("create", func() { Context("multipleSourceComponent test", func() { defer GinkgoRecover() - streams := genericclioptions.IOStreams{ + streams := genericiooptions.IOStreams{ In: os.Stdin, Out: os.Stdout, ErrOut: os.Stdout, diff --git a/internal/cli/cmd/cluster/dataprotection.go b/internal/cli/cmd/cluster/dataprotection.go index 2e85d84c737..14c1510a1a5 100644 --- a/internal/cli/cmd/cluster/dataprotection.go +++ b/internal/cli/cmd/cluster/dataprotection.go @@ -39,7 +39,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/duration" "k8s.io/apimachinery/pkg/util/json" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" @@ -148,7 +148,7 @@ type DescribeBackupOptions struct { Gvr schema.GroupVersionResource names []string - genericclioptions.IOStreams + genericiooptions.IOStreams } func (o *CreateBackupOptions) CompleteBackup() error { @@ -231,7 +231,7 @@ func (o *CreateBackupOptions) getDefaultBackupPolicy() (string, error) { return defaultBackupPolicies[0].GetName(), nil } -func NewCreateBackupCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewCreateBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { customOutPut := func(opt *create.CreateOptions) { output := fmt.Sprintf("Backup %s created successfully, you can view the progress:", opt.Name) printer.PrintLine(output) @@ -332,7 +332,7 @@ func PrintBackupList(o ListBackupOptions) error { return nil } -func NewListBackupCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &ListBackupOptions{ListOptions: list.NewListOptions(f, streams, types.BackupGVR())} cmd := &cobra.Command{ Use: "list-backups", @@ -355,7 +355,7 @@ func NewListBackupCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *c return cmd } -func NewDescribeBackupCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescribeBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &DescribeBackupOptions{ Factory: f, IOStreams: streams, @@ -376,7 +376,7 @@ func NewDescribeBackupCmd(f cmdutil.Factory, streams genericclioptions.IOStreams return cmd } -func NewDeleteBackupCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDeleteBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := delete.NewDeleteOptions(f, streams, types.BackupGVR()) cmd := &cobra.Command{ Use: "delete-backup", @@ -526,7 +526,7 @@ func (o *CreateRestoreOptions) Validate() error { return nil } -func NewCreateRestoreCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewCreateRestoreCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &CreateRestoreOptions{} o.CreateOptions = create.CreateOptions{ IOStreams: streams, @@ -552,7 +552,7 @@ func NewCreateRestoreCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) return cmd } -func NewListBackupPolicyCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListBackupPolicyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.BackupPolicyGVR()) cmd := &cobra.Command{ Use: "list-backup-policy", @@ -627,7 +627,7 @@ type editBackupPolicyOptions struct { Factory cmdutil.Factory GVR schema.GroupVersionResource - genericclioptions.IOStreams + genericiooptions.IOStreams editContent []editorRow editContentKeyMap map[string]updateBackupPolicyFieldFunc original string @@ -645,7 +645,7 @@ type editorRow struct { updateFunc updateBackupPolicyFieldFunc } -func NewEditBackupPolicyCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewEditBackupPolicyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := editBackupPolicyOptions{Factory: f, IOStreams: streams, GVR: types.BackupPolicyGVR()} cmd := &cobra.Command{ Use: "edit-backup-policy", @@ -865,7 +865,7 @@ type describeBackupPolicyOptions struct { Factory cmdutil.Factory client clientset.Interface - genericclioptions.IOStreams + genericiooptions.IOStreams } func (o *describeBackupPolicyOptions) Complete(args []string) error { @@ -924,7 +924,7 @@ func (o *describeBackupPolicyOptions) printBackupPolicyObj(obj *dpv1alpha1.Backu return nil } -func NewDescribeBackupPolicyCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescribeBackupPolicyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &describeBackupPolicyOptions{ Factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/cluster/dataprotection_test.go b/internal/cli/cmd/cluster/dataprotection_test.go index c9676b842c2..4aaab29f18a 100644 --- a/internal/cli/cmd/cluster/dataprotection_test.go +++ b/internal/cli/cmd/cluster/dataprotection_test.go @@ -33,7 +33,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" k8sapitypes "k8s.io/apimachinery/pkg/types" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -53,11 +53,11 @@ import ( var _ = Describe("DataProtection", func() { const policyName = "policy" const repoName = "repo" - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory var out *bytes.Buffer BeforeEach(func() { - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/cluster/delete.go b/internal/cli/cmd/cluster/delete.go index 47dd70e55ff..5dc881745e6 100644 --- a/internal/cli/cmd/cluster/delete.go +++ b/internal/cli/cmd/cluster/delete.go @@ -29,7 +29,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/errors" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -52,7 +52,7 @@ var ( rbacEnabled = false ) -func NewDeleteCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDeleteCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := delete.NewDeleteOptions(f, streams, types.ClusterGVR()) o.PreDeleteHook = clusterPreDeleteHook o.PostDeleteHook = clusterPostDeleteHook diff --git a/internal/cli/cmd/cluster/delete_ops.go b/internal/cli/cmd/cluster/delete_ops.go index c7be553db37..946bb4f7dad 100644 --- a/internal/cli/cmd/cluster/delete_ops.go +++ b/internal/cli/cmd/cluster/delete_ops.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" apitypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/json" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -50,7 +50,7 @@ var ( `) ) -func NewDeleteOpsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDeleteOpsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := delete.NewDeleteOptions(f, streams, types.OpsGVR()) o.PreDeleteHook = preDeleteOps cmd := &cobra.Command{ diff --git a/internal/cli/cmd/cluster/delete_ops_test.go b/internal/cli/cmd/cluster/delete_ops_test.go index 6d8f0794769..ed794b9a8a5 100644 --- a/internal/cli/cmd/cluster/delete_ops_test.go +++ b/internal/cli/cmd/cluster/delete_ops_test.go @@ -30,7 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -50,7 +50,7 @@ var _ = Describe("Expose", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory in *bytes.Buffer ) @@ -70,7 +70,7 @@ var _ = Describe("Expose", func() { } } BeforeEach(func() { - streams, in, _, _ = genericclioptions.NewTestIOStreams() + streams, in, _, _ = genericiooptions.NewTestIOStreams() tf = clitesting.NewTestFactory(namespace) }) diff --git a/internal/cli/cmd/cluster/describe.go b/internal/cli/cmd/cluster/describe.go index da71de8d506..b206c47ee64 100644 --- a/internal/cli/cmd/cluster/describe.go +++ b/internal/cli/cmd/cluster/describe.go @@ -30,7 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -69,10 +69,10 @@ type describeOptions struct { names []string *cluster.ClusterObjects - genericclioptions.IOStreams + genericiooptions.IOStreams } -func newOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *describeOptions { +func newOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *describeOptions { return &describeOptions{ factory: f, IOStreams: streams, @@ -80,7 +80,7 @@ func newOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *describ } } -func NewDescribeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescribeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newOptions(f, streams) cmd := &cobra.Command{ Use: "describe NAME", diff --git a/internal/cli/cmd/cluster/describe_ops.go b/internal/cli/cmd/cluster/describe_ops.go index a92c0548d1d..044a66aadec 100644 --- a/internal/cli/cmd/cluster/describe_ops.go +++ b/internal/cli/cmd/cluster/describe_ops.go @@ -30,7 +30,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" @@ -60,14 +60,14 @@ type describeOpsOptions struct { gvr schema.GroupVersionResource names []string - genericclioptions.IOStreams + genericiooptions.IOStreams } type opsObject interface { appsv1alpha1.VerticalScaling | appsv1alpha1.HorizontalScaling | appsv1alpha1.OpsRequestVolumeClaimTemplate | appsv1alpha1.VolumeExpansion } -func newDescribeOpsOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *describeOpsOptions { +func newDescribeOpsOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *describeOpsOptions { return &describeOpsOptions{ factory: f, IOStreams: streams, @@ -75,7 +75,7 @@ func newDescribeOpsOptions(f cmdutil.Factory, streams genericclioptions.IOStream } } -func NewDescribeOpsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescribeOpsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newDescribeOpsOptions(f, streams) cmd := &cobra.Command{ Use: "describe-ops", diff --git a/internal/cli/cmd/cluster/describe_ops_test.go b/internal/cli/cmd/cluster/describe_ops_test.go index cbbb710bd33..723807403d1 100644 --- a/internal/cli/cmd/cluster/describe_ops_test.go +++ b/internal/cli/cmd/cluster/describe_ops_test.go @@ -32,7 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -53,12 +53,12 @@ var _ = Describe("Expose", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = clitesting.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/cluster/describe_test.go b/internal/cli/cmd/cluster/describe_test.go index c5f39abeb11..64bfcac9061 100644 --- a/internal/cli/cmd/cluster/describe_test.go +++ b/internal/cli/cmd/cluster/describe_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -47,13 +47,13 @@ var _ = Describe("Expose", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/cluster/label.go b/internal/cli/cmd/cluster/label.go index 1945852b2c9..ef6cd301925 100644 --- a/internal/cli/cmd/cluster/label.go +++ b/internal/cli/cmd/cluster/label.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ktypes "k8s.io/apimachinery/pkg/types" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -82,10 +82,10 @@ type LabelOptions struct { builder *resource.Builder unstructuredClientForMapping func(mapping *meta.RESTMapping) (resource.RESTClient, error) - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewLabelOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, gvr schema.GroupVersionResource) *LabelOptions { +func NewLabelOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, gvr schema.GroupVersionResource) *LabelOptions { return &LabelOptions{ Factory: f, GVR: gvr, @@ -93,7 +93,7 @@ func NewLabelOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, gvr } } -func NewLabelCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewLabelCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewLabelOptions(f, streams, types.ClusterGVR()) cmd := &cobra.Command{ Use: "label NAME", diff --git a/internal/cli/cmd/cluster/label_test.go b/internal/cli/cmd/cluster/label_test.go index a52910b7d1f..4be47018b26 100644 --- a/internal/cli/cmd/cluster/label_test.go +++ b/internal/cli/cmd/cluster/label_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "github.com/apecloud/kubeblocks/internal/cli/types" @@ -32,12 +32,12 @@ import ( var _ = Describe("cluster label", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace("default") }) diff --git a/internal/cli/cmd/cluster/list.go b/internal/cli/cmd/cluster/list.go index 6e9807e8a3d..b24ae261f46 100644 --- a/internal/cli/cmd/cluster/list.go +++ b/internal/cli/cmd/cluster/list.go @@ -23,7 +23,7 @@ import ( "fmt" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -75,7 +75,7 @@ var ( kbcli cluster list-events mycluster`) ) -func NewListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.ClusterGVR()) cmd := &cobra.Command{ Use: "list [NAME]", @@ -96,7 +96,7 @@ func NewListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C return cmd } -func NewListInstancesCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListInstancesCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.ClusterGVR()) cmd := &cobra.Command{ Use: "list-instances", @@ -114,7 +114,7 @@ func NewListInstancesCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) return cmd } -func NewListComponentsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListComponentsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.ClusterGVR()) cmd := &cobra.Command{ Use: "list-components", @@ -132,7 +132,7 @@ func NewListComponentsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams return cmd } -func NewListEventsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListEventsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.ClusterGVR()) cmd := &cobra.Command{ Use: "list-events", diff --git a/internal/cli/cmd/cluster/list_logs.go b/internal/cli/cmd/cluster/list_logs.go index e3273f036d0..863be24dd5e 100644 --- a/internal/cli/cmd/cluster/list_logs.go +++ b/internal/cli/cmd/cluster/list_logs.go @@ -27,7 +27,7 @@ import ( "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -64,11 +64,11 @@ type ListLogsOptions struct { dynamicClient dynamic.Interface clientSet *kubernetes.Clientset factory cmdutil.Factory - genericclioptions.IOStreams + genericiooptions.IOStreams exec *exec.ExecOptions } -func NewListLogsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListLogsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &ListLogsOptions{ factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/cluster/list_logs_test.go b/internal/cli/cmd/cluster/list_logs_test.go index 888c01b69cd..e2b7a245044 100644 --- a/internal/cli/cmd/cluster/list_logs_test.go +++ b/internal/cli/cmd/cluster/list_logs_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" "k8s.io/client-go/rest/fake" @@ -57,7 +57,7 @@ var _ = Describe("listLogs test", func() { } tf.ClientConfigVal = &restclient.Config{APIPath: "/api", ContentConfig: restclient.ContentConfig{NegotiatedSerializer: scheme.Codecs, GroupVersion: &schema.GroupVersion{Version: "v1"}}} - stream := genericclioptions.NewTestIOStreamsDiscard() + stream := genericiooptions.NewTestIOStreamsDiscard() o := &ListLogsOptions{ factory: tf, IOStreams: stream, @@ -115,7 +115,7 @@ var _ = Describe("listLogs test", func() { dataObj.Pods.Items = append(dataObj.Pods.Items, pod) o := &ListLogsOptions{ exec: &exec.ExecOptions{}, - IOStreams: genericclioptions.IOStreams{ + IOStreams: genericiooptions.IOStreams{ Out: os.Stdout, ErrOut: os.Stdout, }, diff --git a/internal/cli/cmd/cluster/list_ops.go b/internal/cli/cmd/cluster/list_ops.go index acc0503461b..7fde673f02b 100644 --- a/internal/cli/cmd/cluster/list_ops.go +++ b/internal/cli/cmd/cluster/list_ops.go @@ -30,7 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -59,7 +59,7 @@ type opsListOptions struct { opsRequestName string } -func NewListOpsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListOpsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &opsListOptions{ ListOptions: list.NewListOptions(f, streams, types.OpsGVR()), } diff --git a/internal/cli/cmd/cluster/list_ops_test.go b/internal/cli/cmd/cluster/list_ops_test.go index 25867b33359..0f3fcaab688 100644 --- a/internal/cli/cmd/cluster/list_ops_test.go +++ b/internal/cli/cmd/cluster/list_ops_test.go @@ -28,7 +28,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" appsv1alpha1 "github.com/apecloud/kubeblocks/apis/apps/v1alpha1" @@ -50,13 +50,13 @@ var _ = Describe("Expose", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory opsName string ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = clitesting.NewTestFactory(namespace) }) @@ -113,7 +113,7 @@ var _ = Describe("Expose", func() { } initOpsOption := func(status []string, opsTypes []string) *opsListOptions { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() return &opsListOptions{ ListOptions: list.NewListOptions(tf, streams, types.OpsGVR()), status: status, diff --git a/internal/cli/cmd/cluster/list_test.go b/internal/cli/cmd/cluster/list_test.go index 4d8206d1030..e052d413eee 100644 --- a/internal/cli/cmd/cluster/list_test.go +++ b/internal/cli/cmd/cluster/list_test.go @@ -30,7 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -44,7 +44,7 @@ import ( var _ = Describe("list", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams out *bytes.Buffer tf *cmdtesting.TestFactory ) @@ -58,7 +58,7 @@ var _ = Describe("list", func() { ) BeforeEach(func() { - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) _ = appsv1alpha1.AddToScheme(scheme.Scheme) diff --git a/internal/cli/cmd/cluster/logs.go b/internal/cli/cmd/cluster/logs.go index 8c452f04419..080db78e6e9 100644 --- a/internal/cli/cmd/cluster/logs.go +++ b/internal/cli/cmd/cluster/logs.go @@ -30,7 +30,7 @@ import ( "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdlogs "k8s.io/kubectl/pkg/cmd/logs" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/polymorphichelpers" @@ -85,7 +85,7 @@ type LogsOptions struct { } // NewLogsCmd returns the logic of accessing cluster log file -func NewLogsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewLogsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { l := &LogsOptions{ ExecOptions: exec.NewExecOptions(f, streams), logOptions: cmdlogs.LogsOptions{ diff --git a/internal/cli/cmd/cluster/logs_test.go b/internal/cli/cmd/cluster/logs_test.go index 70126f7fe0d..e6a6863a277 100644 --- a/internal/cli/cmd/cluster/logs_test.go +++ b/internal/cli/cmd/cluster/logs_test.go @@ -30,7 +30,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" "k8s.io/client-go/rest/fake" @@ -110,7 +110,7 @@ var _ = Describe("logs", func() { } tf.ClientConfigVal = &restclient.Config{APIPath: "/api", ContentConfig: restclient.ContentConfig{NegotiatedSerializer: scheme.Codecs, GroupVersion: &schema.GroupVersion{Version: "v1"}}} - stream := genericclioptions.NewTestIOStreamsDiscard() + stream := genericiooptions.NewTestIOStreamsDiscard() l := &LogsOptions{ ExecOptions: exec.NewExecOptions(tf, stream), logOptions: cmdlogs.LogsOptions{ diff --git a/internal/cli/cmd/cluster/operations.go b/internal/cli/cmd/cluster/operations.go index c61ba9bb5bc..66201aac815 100755 --- a/internal/cli/cmd/cluster/operations.go +++ b/internal/cli/cmd/cluster/operations.go @@ -34,7 +34,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" apitypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/json" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" "sigs.k8s.io/controller-runtime/pkg/client" @@ -101,7 +101,7 @@ type OperationsOptions struct { Instance string `json:"instance"` } -func newBaseOperationsOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, +func newBaseOperationsOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, opsType appsv1alpha1.OpsType, hasComponentNamesFlag bool) *OperationsOptions { customOutPut := func(opt *create.CreateOptions) { output := fmt.Sprintf("OpsRequest %s created successfully, you can view the progress:", opt.Name) @@ -513,7 +513,7 @@ var restartExample = templates.Examples(` `) // NewRestartCmd creates a restart command -func NewRestartCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewRestartCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.RestartType, true) cmd := &cobra.Command{ Use: "restart NAME", @@ -540,7 +540,7 @@ var upgradeExample = templates.Examples(` `) // NewUpgradeCmd creates an upgrade command -func NewUpgradeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewUpgradeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.UpgradeType, false) cmd := &cobra.Command{ Use: "upgrade NAME", @@ -571,7 +571,7 @@ var verticalScalingExample = templates.Examples(` `) // NewVerticalScalingCmd creates a vertical scaling command -func NewVerticalScalingCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewVerticalScalingCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.VerticalScalingType, true) cmd := &cobra.Command{ Use: "vscale NAME", @@ -602,7 +602,7 @@ var horizontalScalingExample = templates.Examples(` `) // NewHorizontalScalingCmd creates a horizontal scaling command -func NewHorizontalScalingCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewHorizontalScalingCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.HorizontalScalingType, true) cmd := &cobra.Command{ Use: "hscale NAME", @@ -633,7 +633,7 @@ var volumeExpansionExample = templates.Examples(` `) // NewVolumeExpansionCmd creates a volume expanding command -func NewVolumeExpansionCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewVolumeExpansionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.VolumeExpansionType, true) cmd := &cobra.Command{ Use: "volume-expand NAME", @@ -673,7 +673,7 @@ var ( ) // NewExposeCmd creates an expose command -func NewExposeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewExposeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.ExposeType, true) cmd := &cobra.Command{ Use: "expose NAME --enable=[true|false] --type=[vpc|internet]", @@ -712,7 +712,7 @@ var stopExample = templates.Examples(` `) // NewStopCmd creates a stop command -func NewStopCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewStopCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.StopType, false) cmd := &cobra.Command{ Use: "stop NAME", @@ -738,7 +738,7 @@ var startExample = templates.Examples(` `) // NewStartCmd creates a start command -func NewStartCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewStartCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.StartType, false) o.autoApprove = true cmd := &cobra.Command{ @@ -806,7 +806,7 @@ func cancelOps(o *OperationsOptions) error { return nil } -func NewCancelCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewCancelCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, "", false) cmd := &cobra.Command{ Use: "cancel-ops NAME", @@ -836,7 +836,7 @@ var promoteExample = templates.Examples(` `) // NewPromoteCmd creates a promote command -func NewPromoteCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPromoteCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newBaseOperationsOptions(f, streams, appsv1alpha1.SwitchoverType, false) cmd := &cobra.Command{ Use: "promote NAME [--component=] [--instance ]", diff --git a/internal/cli/cmd/cluster/operations_test.go b/internal/cli/cmd/cluster/operations_test.go index 133c359161c..34ffae63b10 100644 --- a/internal/cli/cmd/cluster/operations_test.go +++ b/internal/cli/cmd/cluster/operations_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -46,13 +46,13 @@ var _ = Describe("operations", func() { clusterName1 = "cluster-ops1" ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory in *bytes.Buffer ) BeforeEach(func() { - streams, in, _, _ = genericclioptions.NewTestIOStreams() + streams, in, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) clusterWithTwoComps := testing.FakeCluster(clusterName, testing.Namespace) clusterWithOneComp := clusterWithTwoComps.DeepCopy() diff --git a/internal/cli/cmd/cluster/register.go b/internal/cli/cmd/cluster/register.go index 903cb246a36..a9894e4b298 100644 --- a/internal/cli/cmd/cluster/register.go +++ b/internal/cli/cmd/cluster/register.go @@ -31,7 +31,7 @@ import ( "github.com/asaskevich/govalidator" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -51,7 +51,7 @@ var clusterRegisterExample = templates.Examples(` type registerOption struct { Factory cmdutil.Factory - genericclioptions.IOStreams + genericiooptions.IOStreams clusterType cluster.ClusterType source string @@ -64,7 +64,7 @@ type registerOption struct { replace bool } -func newRegisterOption(f cmdutil.Factory, streams genericclioptions.IOStreams) *registerOption { +func newRegisterOption(f cmdutil.Factory, streams genericiooptions.IOStreams) *registerOption { o := ®isterOption{ Factory: f, IOStreams: streams, @@ -72,7 +72,7 @@ func newRegisterOption(f cmdutil.Factory, streams genericclioptions.IOStreams) * return o } -func newRegisterCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newRegisterCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newRegisterOption(f, streams) cmd := &cobra.Command{ Use: "register [NAME] --source [CHART-URL]", diff --git a/internal/cli/cmd/cluster/register_test.go b/internal/cli/cmd/cluster/register_test.go index 6324163c583..9c29ac0a4a1 100644 --- a/internal/cli/cmd/cluster/register_test.go +++ b/internal/cli/cmd/cluster/register_test.go @@ -26,16 +26,16 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("cluster register", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory var tempLocalPath string BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace("default") tempLocalPath = filepath.Join(os.TempDir(), "fake.tgz") Expect(os.WriteFile(tempLocalPath, []byte("fake-data"), 0666)).Should(Succeed()) diff --git a/internal/cli/cmd/cluster/update.go b/internal/cli/cmd/cluster/update.go index d02ffa997d2..51402b2e626 100644 --- a/internal/cli/cmd/cluster/update.go +++ b/internal/cli/cmd/cluster/update.go @@ -38,7 +38,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -110,7 +110,7 @@ type updateOptions struct { *patch.Options } -func NewUpdateCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewUpdateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &updateOptions{Options: patch.NewOptions(f, streams, types.ClusterGVR())} o.Options.OutputOperation = func(didPatch bool) string { if didPatch { diff --git a/internal/cli/cmd/cluster/update_test.go b/internal/cli/cmd/cluster/update_test.go index b07f0f8a744..a5a83422000 100644 --- a/internal/cli/cmd/cluster/update_test.go +++ b/internal/cli/cmd/cluster/update_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -35,11 +35,11 @@ import ( ) var _ = Describe("cluster update", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace("default") }) diff --git a/internal/cli/cmd/clusterdefinition/clusterdefinition.go b/internal/cli/cmd/clusterdefinition/clusterdefinition.go index 8fad035f4e0..7d881d02443 100644 --- a/internal/cli/cmd/clusterdefinition/clusterdefinition.go +++ b/internal/cli/cmd/clusterdefinition/clusterdefinition.go @@ -21,7 +21,7 @@ package clusterdefinition import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -34,7 +34,7 @@ var listExample = templates.Examples(` # list all ClusterDefinitions kbcli clusterdefinition list`) -func NewClusterDefinitionCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewClusterDefinitionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "clusterdefinition", Short: "ClusterDefinition command.", @@ -47,7 +47,7 @@ func NewClusterDefinitionCmd(f cmdutil.Factory, streams genericclioptions.IOStre return cmd } -func NewListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.ClusterDefGVR()) cmd := &cobra.Command{ Use: "list", diff --git a/internal/cli/cmd/clusterdefinition/clusterdefinition_test.go b/internal/cli/cmd/clusterdefinition/clusterdefinition_test.go index 6673b181f5a..428928810ff 100644 --- a/internal/cli/cmd/clusterdefinition/clusterdefinition_test.go +++ b/internal/cli/cmd/clusterdefinition/clusterdefinition_test.go @@ -22,16 +22,16 @@ package clusterdefinition import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("clusterdefinition", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory() }) diff --git a/internal/cli/cmd/clusterdefinition/describe.go b/internal/cli/cmd/clusterdefinition/describe.go index 9367f0e562f..8eeb52491d2 100644 --- a/internal/cli/cmd/clusterdefinition/describe.go +++ b/internal/cli/cmd/clusterdefinition/describe.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -52,10 +52,10 @@ type describeOptions struct { namespace string names []string - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewDescribeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescribeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &describeOptions{ factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/clusterdefinition/list_component_test.go b/internal/cli/cmd/clusterdefinition/list_component_test.go index 4eb6a8efe9d..fab8c28a080 100644 --- a/internal/cli/cmd/clusterdefinition/list_component_test.go +++ b/internal/cli/cmd/clusterdefinition/list_component_test.go @@ -30,7 +30,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -45,7 +45,7 @@ import ( var _ = Describe("clusterdefinition list components", func() { var ( cmd *cobra.Command - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams out *bytes.Buffer tf *cmdtesting.TestFactory ) @@ -72,7 +72,7 @@ var _ = Describe("clusterdefinition list components", func() { _ = appsv1alpha1.AddToScheme(scheme.Scheme) clusterDef := testing.FakeClusterDef() tf = mockClient(clusterDef) - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() cmd = NewListComponentsCmd(tf, streams) }) diff --git a/internal/cli/cmd/clusterdefinition/list_components.go b/internal/cli/cmd/clusterdefinition/list_components.go index eb66dc9be79..32b8d2ee0f4 100644 --- a/internal/cli/cmd/clusterdefinition/list_components.go +++ b/internal/cli/cmd/clusterdefinition/list_components.go @@ -25,7 +25,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -42,7 +42,7 @@ var ( kbcli clusterdefinition list-components apecloud-mysql`) ) -func NewListComponentsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListComponentsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.ClusterDefGVR()) o.AllNamespaces = true cmd := &cobra.Command{ diff --git a/internal/cli/cmd/clusterversion/clusterversion.go b/internal/cli/cmd/clusterversion/clusterversion.go index e1bea0c7a5a..7390b1a044d 100644 --- a/internal/cli/cmd/clusterversion/clusterversion.go +++ b/internal/cli/cmd/clusterversion/clusterversion.go @@ -23,7 +23,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -45,7 +45,7 @@ type ListClusterVersionOptions struct { clusterDefinitionRef string } -func NewClusterVersionCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewClusterVersionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "clusterversion", Short: "ClusterVersion command.", @@ -58,7 +58,7 @@ func NewClusterVersionCmd(f cmdutil.Factory, streams genericclioptions.IOStreams return cmd } -func NewListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &ListClusterVersionOptions{ ListOptions: list.NewListOptions(f, streams, types.ClusterVersionGVR()), } diff --git a/internal/cli/cmd/clusterversion/clusterversion_test.go b/internal/cli/cmd/clusterversion/clusterversion_test.go index 11880920b26..3d78f80e871 100644 --- a/internal/cli/cmd/clusterversion/clusterversion_test.go +++ b/internal/cli/cmd/clusterversion/clusterversion_test.go @@ -30,7 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -43,7 +43,7 @@ import ( ) var _ = Describe("clusterversion", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory out := new(bytes.Buffer) var CreateTime string @@ -63,7 +63,7 @@ var _ = Describe("clusterversion", func() { BeforeEach(func() { _ = appsv1alpha1.AddToScheme(scheme.Scheme) _ = metav1.AddMetaToScheme(scheme.Scheme) - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() fakeCV := testing.FakeClusterVersion() CreateTime = util.TimeFormat(&fakeCV.CreationTimestamp) tf = mockClient(fakeCV) diff --git a/internal/cli/cmd/clusterversion/set_default.go b/internal/cli/cmd/clusterversion/set_default.go index 35c016eb76e..44a8a4c77ab 100644 --- a/internal/cli/cmd/clusterversion/set_default.go +++ b/internal/cli/cmd/clusterversion/set_default.go @@ -28,7 +28,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" utilerrors "k8s.io/apimachinery/pkg/util/errors" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -58,12 +58,12 @@ const ( type SetOrUnsetDefaultOption struct { Factory cmdutil.Factory - IOStreams genericclioptions.IOStreams + IOStreams genericiooptions.IOStreams // `set-default` sets the setDefault to true, `unset-default` sets to false setDefault bool } -func newSetOrUnsetDefaultOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, toSet bool) *SetOrUnsetDefaultOption { +func newSetOrUnsetDefaultOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, toSet bool) *SetOrUnsetDefaultOption { return &SetOrUnsetDefaultOption{ Factory: f, IOStreams: streams, @@ -71,7 +71,7 @@ func newSetOrUnsetDefaultOptions(f cmdutil.Factory, streams genericclioptions.IO } } -func newSetDefaultCMD(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newSetDefaultCMD(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newSetOrUnsetDefaultOptions(f, streams, true) cmd := &cobra.Command{ Use: "set-default NAME", @@ -86,7 +86,7 @@ func newSetDefaultCMD(f cmdutil.Factory, streams genericclioptions.IOStreams) *c return cmd } -func newUnSetDefaultCMD(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newUnSetDefaultCMD(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newSetOrUnsetDefaultOptions(f, streams, false) cmd := &cobra.Command{ Use: "unset-default NAME", diff --git a/internal/cli/cmd/clusterversion/set_default_test.go b/internal/cli/cmd/clusterversion/set_default_test.go index 0d31d62d22b..7e982a234f3 100644 --- a/internal/cli/cmd/clusterversion/set_default_test.go +++ b/internal/cli/cmd/clusterversion/set_default_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -39,11 +39,11 @@ import ( ) var _ = Describe("set-default", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory const ( - cluterversion = testing.ClusterVersionName + clusterVersion = testing.ClusterVersionName clusterversionInSameCD = testing.ClusterVersionName + "-sameCD" ClusterversionOtherCD = testing.ClusterVersionName + "-other" errorClusterversion = "08jfa2" @@ -53,7 +53,7 @@ var _ = Describe("set-default", func() { tf.FakeDynamicClient = testing.FakeDynamicClient([]runtime.Object{ &appsv1alpha1.ClusterVersion{ ObjectMeta: metav1.ObjectMeta{ - Name: cluterversion, + Name: clusterVersion, Labels: map[string]string{ constant.ClusterDefLabelKey: testing.ClusterDefName, }, @@ -105,7 +105,7 @@ var _ = Describe("set-default", func() { BeforeEach(func() { _ = appsv1alpha1.AddToScheme(scheme.Scheme) _ = metav1.AddMetaToScheme(scheme.Scheme) - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(testing.Namespace) tf.Client = &clientfake.RESTClient{} beginWithMultipleClusterversion() @@ -154,21 +154,21 @@ var _ = Describe("set-default", func() { It("set-default and unset-default", func() { // before set-default - validateSetOrUnsetResult([]string{cluterversion}, []string{annotationFalseValue}) + validateSetOrUnsetResult([]string{clusterVersion}, []string{annotationFalseValue}) // set-default cmd := newSetDefaultCMD(tf, streams) - cmd.Run(cmd, []string{cluterversion}) - validateSetOrUnsetResult([]string{cluterversion}, []string{annotationTrueValue}) + cmd.Run(cmd, []string{clusterVersion}) + validateSetOrUnsetResult([]string{clusterVersion}, []string{annotationTrueValue}) // unset-default cmd = newUnSetDefaultCMD(tf, streams) - cmd.Run(cmd, []string{cluterversion}) - validateSetOrUnsetResult([]string{cluterversion}, []string{annotationFalseValue}) + cmd.Run(cmd, []string{clusterVersion}) + validateSetOrUnsetResult([]string{clusterVersion}, []string{annotationFalseValue}) }) It("the clusterDef already has a default cv when set-default", func() { cmd := newSetDefaultCMD(tf, streams) - cmd.Run(cmd, []string{cluterversion}) - validateSetOrUnsetResult([]string{cluterversion, clusterversionInSameCD}, []string{annotationTrueValue, annotationFalseValue}) + cmd.Run(cmd, []string{clusterVersion}) + validateSetOrUnsetResult([]string{clusterVersion, clusterversionInSameCD}, []string{annotationTrueValue, annotationFalseValue}) o := newSetOrUnsetDefaultOptions(tf, streams, true) err := o.run([]string{clusterversionInSameCD}) Expect(err).Should(HaveOccurred()) @@ -176,19 +176,19 @@ var _ = Describe("set-default", func() { It("set-default args belonging to the same cd", func() { o := newSetOrUnsetDefaultOptions(tf, streams, true) - err := o.run([]string{cluterversion, cluterversion}) + err := o.run([]string{clusterVersion, clusterVersion}) Expect(err).Should(HaveOccurred()) }) It("set-default and unset-default multiple args", func() { cmd := newSetDefaultCMD(tf, streams) - validateSetOrUnsetResult([]string{cluterversion, ClusterversionOtherCD}, []string{annotationFalseValue, annotationFalseValue}) + validateSetOrUnsetResult([]string{clusterVersion, ClusterversionOtherCD}, []string{annotationFalseValue, annotationFalseValue}) // set-default - cmd.Run(cmd, []string{cluterversion, ClusterversionOtherCD}) - validateSetOrUnsetResult([]string{cluterversion, ClusterversionOtherCD}, []string{annotationTrueValue, annotationTrueValue}) + cmd.Run(cmd, []string{clusterVersion, ClusterversionOtherCD}) + validateSetOrUnsetResult([]string{clusterVersion, ClusterversionOtherCD}, []string{annotationTrueValue, annotationTrueValue}) // unset-default cmd = newUnSetDefaultCMD(tf, streams) - cmd.Run(cmd, []string{cluterversion, ClusterversionOtherCD}) - validateSetOrUnsetResult([]string{cluterversion, ClusterversionOtherCD}, []string{annotationFalseValue, annotationFalseValue}) + cmd.Run(cmd, []string{clusterVersion, ClusterversionOtherCD}) + validateSetOrUnsetResult([]string{clusterVersion, ClusterversionOtherCD}, []string{annotationFalseValue, annotationFalseValue}) }) }) diff --git a/internal/cli/cmd/context/cloud_context.go b/internal/cli/cmd/context/cloud_context.go index a0464735284..bf805337e1d 100644 --- a/internal/cli/cmd/context/cloud_context.go +++ b/internal/cli/cmd/context/cloud_context.go @@ -30,7 +30,7 @@ import ( "github.com/jedib0t/go-pretty/v6/table" "github.com/pkg/errors" "gopkg.in/yaml.v2" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/cmd/organization" "github.com/apecloud/kubeblocks/internal/cli/printer" @@ -44,7 +44,7 @@ type CloudContext struct { APIPath string OutputFormat string - genericclioptions.IOStreams + genericiooptions.IOStreams } type Metadata struct { diff --git a/internal/cli/cmd/context/context.go b/internal/cli/cmd/context/context.go index 01593dd73bf..2441c830482 100644 --- a/internal/cli/cmd/context/context.go +++ b/internal/cli/cmd/context/context.go @@ -22,7 +22,7 @@ package context import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -57,10 +57,10 @@ type ContextOptions struct { Context Context OutputFormat string - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewContextCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewContextCmd(streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "context", Short: "kbcli context allows you to manage cloud context. This command is currently only applicable to cloud," + @@ -76,7 +76,7 @@ func NewContextCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newContextListCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newContextListCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &ContextOptions{IOStreams: streams} cmd := &cobra.Command{ @@ -91,7 +91,7 @@ func newContextListCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newContextCurrentCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newContextCurrentCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &ContextOptions{IOStreams: streams} cmd := &cobra.Command{ @@ -106,7 +106,7 @@ func newContextCurrentCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newContextDescribeCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newContextDescribeCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &ContextOptions{IOStreams: streams} cmd := &cobra.Command{ @@ -124,7 +124,7 @@ func newContextDescribeCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newContextUseCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newContextUseCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &ContextOptions{IOStreams: streams} cmd := &cobra.Command{ diff --git a/internal/cli/cmd/context/context_text.go b/internal/cli/cmd/context/context_text.go index ef2a28499f0..faf40d2eb37 100644 --- a/internal/cli/cmd/context/context_text.go +++ b/internal/cli/cmd/context/context_text.go @@ -23,13 +23,13 @@ import ( ginkgo_context "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/cmd/organization" ) type MockContext struct { - genericclioptions.IOStreams + genericiooptions.IOStreams } func (m *MockContext) showContext() error { @@ -54,11 +54,11 @@ func (m *MockContext) showRemoveContext() error { var _ = ginkgo_context.Describe("Test Cloud Context", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams o *ContextOptions ) ginkgo_context.BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() o = &ContextOptions{ ContextName: "test_context", Context: &MockContext{ diff --git a/internal/cli/cmd/dashboard/dashboard.go b/internal/cli/cmd/dashboard/dashboard.go index c3300b40847..7f60e46ac9a 100644 --- a/internal/cli/cmd/dashboard/dashboard.go +++ b/internal/cli/cmd/dashboard/dashboard.go @@ -32,7 +32,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/portforward" "k8s.io/client-go/transport/spdy" @@ -163,12 +163,12 @@ var ( ) type listOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams factory cmdutil.Factory client *kubernetes.Clientset } -func newListOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *listOptions { +func newListOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *listOptions { return &listOptions{ factory: f, IOStreams: streams, @@ -176,7 +176,7 @@ func newListOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *lis } // NewDashboardCmd creates the dashboard command -func NewDashboardCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDashboardCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "dashboard", Short: "List and open the KubeBlocks dashboards.", @@ -191,7 +191,7 @@ func NewDashboardCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func newListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newListOptions(f, streams) cmd := &cobra.Command{ Use: "list", @@ -236,14 +236,14 @@ func printTable(out io.Writer) error { type openOptions struct { factory cmdutil.Factory - genericclioptions.IOStreams + genericiooptions.IOStreams portForwardOptions *cmdpf.PortForwardOptions name string localPort string } -func newOpenOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *openOptions { +func newOpenOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *openOptions { return &openOptions{ factory: f, IOStreams: streams, @@ -253,7 +253,7 @@ func newOpenOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *ope } } -func newOpenCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newOpenCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newOpenOptions(f, streams) cmd := &cobra.Command{ Use: "open NAME [DASHBOARD-TYPE] [--port PORT]", @@ -410,7 +410,7 @@ func newFactory(namespace string) cmdutil.Factory { } type defaultPortForwarder struct { - genericclioptions.IOStreams + genericiooptions.IOStreams } func (f *defaultPortForwarder) ForwardPorts(method string, url *url.URL, opts cmdpf.PortForwardOptions) error { diff --git a/internal/cli/cmd/dashboard/dashboard_test.go b/internal/cli/cmd/dashboard/dashboard_test.go index 584dcad3d30..367c67be19b 100644 --- a/internal/cli/cmd/dashboard/dashboard_test.go +++ b/internal/cli/cmd/dashboard/dashboard_test.go @@ -27,7 +27,7 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest/fake" @@ -37,7 +37,7 @@ import ( const namespace = "test" var _ = Describe("kubeblocks", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory fakeSvcs := func() *corev1.ServiceList { @@ -54,7 +54,7 @@ var _ = Describe("kubeblocks", func() { } BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) tf.UnstructuredClient = &fake.RESTClient{ diff --git a/internal/cli/cmd/dataprotection/backup.go b/internal/cli/cmd/dataprotection/backup.go index 031a9c8cb38..ed2f3662646 100644 --- a/internal/cli/cmd/dataprotection/backup.go +++ b/internal/cli/cmd/dataprotection/backup.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -71,7 +71,7 @@ var ( `) ) -func newBackupCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newBackupCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { customOutPut := func(opt *create.CreateOptions) { output := fmt.Sprintf("Backup %s created successfully, you can view the progress:", opt.Name) printer.PrintLine(output) @@ -119,7 +119,7 @@ func newBackupCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *c return cmd } -func newBackupDeleteCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newBackupDeleteCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := delete.NewDeleteOptions(f, streams, types.BackupGVR()) clusterName := "" cmd := &cobra.Command{ @@ -152,7 +152,7 @@ func completeForDeleteBackup(o *delete.DeleteOptions, cluster string) error { return nil } -func newBackupDescribeCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newBackupDescribeCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := cluster.DescribeBackupOptions{ Factory: f, IOStreams: streams, @@ -173,7 +173,7 @@ func newBackupDescribeCommand(f cmdutil.Factory, streams genericclioptions.IOStr return cmd } -func newListBackupCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newListBackupCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &cluster.ListBackupOptions{ListOptions: list.NewListOptions(f, streams, types.BackupGVR())} clusterName := "" cmd := &cobra.Command{ diff --git a/internal/cli/cmd/dataprotection/dataprotection.go b/internal/cli/cmd/dataprotection/dataprotection.go index 77f8beb4394..cff5b8bfd2d 100644 --- a/internal/cli/cmd/dataprotection/dataprotection.go +++ b/internal/cli/cmd/dataprotection/dataprotection.go @@ -21,11 +21,11 @@ package dataprotection import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" ) -func NewDataProtectionCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDataProtectionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "dataprotection command", Short: "Data protection command.", diff --git a/internal/cli/cmd/dataprotection/restore.go b/internal/cli/cmd/dataprotection/restore.go index 2bb44cfbf1b..e5c4c3ec92b 100644 --- a/internal/cli/cmd/dataprotection/restore.go +++ b/internal/cli/cmd/dataprotection/restore.go @@ -21,7 +21,7 @@ package dataprotection import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -38,7 +38,7 @@ var ( kbcli dp restore mybackup --cluster cluster-name`) ) -func newRestoreCommand(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newRestoreCommand(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := cluster.CreateRestoreOptions{} o.CreateOptions = create.CreateOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/fault/fault.go b/internal/cli/cmd/fault/fault.go index 7e7365a5290..763496953dd 100644 --- a/internal/cli/cmd/fault/fault.go +++ b/internal/cli/cmd/fault/fault.go @@ -29,7 +29,7 @@ import ( "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -69,7 +69,7 @@ type FaultBaseOptions struct { create.CreateOptions `json:"-"` } -func NewFaultCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewFaultCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "fault", Short: "Inject faults to pod.", diff --git a/internal/cli/cmd/fault/fault_dns.go b/internal/cli/cmd/fault/fault_dns.go index 81ae14010c6..6a18d1c8084 100644 --- a/internal/cli/cmd/fault/fault_dns.go +++ b/internal/cli/cmd/fault/fault_dns.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -46,7 +46,7 @@ type DNSChaosOptions struct { FaultBaseOptions } -func NewDNSChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, action string) *DNSChaosOptions { +func NewDNSChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, action string) *DNSChaosOptions { o := &DNSChaosOptions{ FaultBaseOptions: FaultBaseOptions{ CreateOptions: create.CreateOptions{ @@ -63,7 +63,7 @@ func NewDNSChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, return o } -func NewDNSChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDNSChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "dns", Short: "Inject faults into DNS server.", @@ -75,7 +75,7 @@ func NewDNSChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cob return cmd } -func NewRandomCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewRandomCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewDNSChaosOptions(f, streams, string(v1alpha1.RandomAction)) cmd := o.NewCobraCommand(Random, RandomShort) @@ -85,7 +85,7 @@ func NewRandomCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra return cmd } -func NewErrorCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewErrorCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewDNSChaosOptions(f, streams, string(v1alpha1.ErrorAction)) cmd := o.NewCobraCommand(Error, ErrorShort) diff --git a/internal/cli/cmd/fault/fault_dns_test.go b/internal/cli/cmd/fault/fault_dns_test.go index d3b0029d9bd..4975e8261f0 100644 --- a/internal/cli/cmd/fault/fault_dns_test.go +++ b/internal/cli/cmd/fault/fault_dns_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/chaos-mesh/chaos-mesh/api/v1alpha1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -34,10 +34,10 @@ import ( var _ = Describe("Fault Network DNS", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/fault_http.go b/internal/cli/cmd/fault/fault_http.go index 13f6b999a9b..31b35a120e9 100644 --- a/internal/cli/cmd/fault/fault_http.go +++ b/internal/cli/cmd/fault/fault_http.go @@ -27,7 +27,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/json" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -95,7 +95,7 @@ type HTTPChaosOptions struct { FaultBaseOptions } -func NewHTTPChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, action string) *HTTPChaosOptions { +func NewHTTPChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, action string) *HTTPChaosOptions { o := &HTTPChaosOptions{ FaultBaseOptions: FaultBaseOptions{ CreateOptions: create.CreateOptions{ @@ -112,7 +112,7 @@ func NewHTTPChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, return o } -func NewHTTPChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewHTTPChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "http", Short: "Intercept HTTP requests and responses.", @@ -126,7 +126,7 @@ func NewHTTPChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func NewAbortCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewAbortCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewHTTPChaosOptions(f, streams, "") cmd := o.NewCobraCommand(Abort, AbortShort) @@ -136,7 +136,7 @@ func NewAbortCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra. return cmd } -func NewHTTPDelayCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewHTTPDelayCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewHTTPChaosOptions(f, streams, "") cmd := o.NewCobraCommand(HTTPDelay, HTTPDelayShort) @@ -146,7 +146,7 @@ func NewHTTPDelayCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func NewReplaceCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewReplaceCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewHTTPChaosOptions(f, streams, "") cmd := o.NewCobraCommand(Replace, ReplaceShort) @@ -158,7 +158,7 @@ func NewReplaceCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobr return cmd } -func NewPatchCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPatchCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewHTTPChaosOptions(f, streams, "") cmd := o.NewCobraCommand(Patch, PatchShort) diff --git a/internal/cli/cmd/fault/fault_http_test.go b/internal/cli/cmd/fault/fault_http_test.go index adec78fb1ec..391eaf1a938 100644 --- a/internal/cli/cmd/fault/fault_http_test.go +++ b/internal/cli/cmd/fault/fault_http_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -33,10 +33,10 @@ import ( var _ = Describe("Fault Network HTPP", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/fault_io.go b/internal/cli/cmd/fault/fault_io.go index 5431e178022..dc2de5bd8d4 100644 --- a/internal/cli/cmd/fault/fault_io.go +++ b/internal/cli/cmd/fault/fault_io.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -93,7 +93,7 @@ type IOChaosOptions struct { FaultBaseOptions } -func NewIOChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewIOChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "io", Short: "IO chaos.", @@ -107,7 +107,7 @@ func NewIOChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobr return cmd } -func NewIOChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, action string) *IOChaosOptions { +func NewIOChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, action string) *IOChaosOptions { o := &IOChaosOptions{ FaultBaseOptions: FaultBaseOptions{ CreateOptions: create.CreateOptions{ @@ -124,7 +124,7 @@ func NewIOChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, a return o } -func NewIOLatencyCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewIOLatencyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewIOChaosOptions(f, streams, string(v1alpha1.IoLatency)) cmd := o.NewCobraCommand(Latency, LatencyShort) @@ -135,7 +135,7 @@ func NewIOLatencyCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func NewIOFaultCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewIOFaultCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewIOChaosOptions(f, streams, string(v1alpha1.IoFaults)) cmd := o.NewCobraCommand(Errno, ErrnoShort) @@ -146,7 +146,7 @@ func NewIOFaultCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobr return cmd } -func NewIOAttributeOverrideCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewIOAttributeOverrideCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewIOChaosOptions(f, streams, string(v1alpha1.IoAttrOverride)) cmd := o.NewCobraCommand(Attribute, AttributeShort) @@ -162,7 +162,7 @@ func NewIOAttributeOverrideCmd(f cmdutil.Factory, streams genericclioptions.IOSt return cmd } -func NewIOMistakeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewIOMistakeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewIOChaosOptions(f, streams, string(v1alpha1.IoMistake)) cmd := o.NewCobraCommand(Mistake, MistakeShort) diff --git a/internal/cli/cmd/fault/fault_io_test.go b/internal/cli/cmd/fault/fault_io_test.go index 6d432869493..d2acacb2f43 100644 --- a/internal/cli/cmd/fault/fault_io_test.go +++ b/internal/cli/cmd/fault/fault_io_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/chaos-mesh/chaos-mesh/api/v1alpha1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -34,10 +34,10 @@ import ( var _ = Describe("Fault IO", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/fault_network.go b/internal/cli/cmd/fault/fault_network.go index 194902bd2e3..0571da4a055 100644 --- a/internal/cli/cmd/fault/fault_network.go +++ b/internal/cli/cmd/fault/fault_network.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -155,7 +155,7 @@ type NetworkChaosOptions struct { FaultBaseOptions } -func NewNetworkChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, action string) *NetworkChaosOptions { +func NewNetworkChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, action string) *NetworkChaosOptions { o := &NetworkChaosOptions{ FaultBaseOptions: FaultBaseOptions{CreateOptions: create.CreateOptions{ Factory: f, @@ -171,7 +171,7 @@ func NewNetworkChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStrea return o } -func NewNetworkChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewNetworkChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "network", Short: "Network chaos.", @@ -189,7 +189,7 @@ func NewNetworkChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) return cmd } -func NewPartitionCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPartitionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNetworkChaosOptions(f, streams, string(v1alpha1.PartitionAction)) cmd := o.NewCobraCommand(Partition, PartitionShort) @@ -198,7 +198,7 @@ func NewPartitionCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func NewLossCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewLossCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNetworkChaosOptions(f, streams, string(v1alpha1.LossAction)) cmd := o.NewCobraCommand(Loss, LossShort) @@ -211,7 +211,7 @@ func NewLossCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C return cmd } -func NewDelayCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDelayCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNetworkChaosOptions(f, streams, string(v1alpha1.DelayAction)) cmd := o.NewCobraCommand(Delay, DelayShort) @@ -225,7 +225,7 @@ func NewDelayCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra. return cmd } -func NewDuplicateCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDuplicateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNetworkChaosOptions(f, streams, string(v1alpha1.DuplicateAction)) cmd := o.NewCobraCommand(Duplicate, DuplicateShort) @@ -238,7 +238,7 @@ func NewDuplicateCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func NewCorruptCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewCorruptCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNetworkChaosOptions(f, streams, string(v1alpha1.CorruptAction)) cmd := o.NewCobraCommand(Corrupt, CorruptShort) @@ -251,7 +251,7 @@ func NewCorruptCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobr return cmd } -func NewBandwidthCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewBandwidthCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNetworkChaosOptions(f, streams, string(v1alpha1.BandwidthAction)) cmd := o.NewCobraCommand(Bandwidth, BandwidthShort) diff --git a/internal/cli/cmd/fault/fault_network_test.go b/internal/cli/cmd/fault/fault_network_test.go index 9b20c708dae..10cfb328690 100644 --- a/internal/cli/cmd/fault/fault_network_test.go +++ b/internal/cli/cmd/fault/fault_network_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/chaos-mesh/chaos-mesh/api/v1alpha1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -34,10 +34,10 @@ import ( var _ = Describe("Fault Network", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/fault_node.go b/internal/cli/cmd/fault/fault_node.go index cfbed438544..102cbfeff03 100644 --- a/internal/cli/cmd/fault/fault_node.go +++ b/internal/cli/cmd/fault/fault_node.go @@ -36,7 +36,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -99,7 +99,7 @@ type NodeChaoOptions struct { create.CreateOptions `json:"-"` } -func NewNodeOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *NodeChaoOptions { +func NewNodeOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *NodeChaoOptions { o := &NodeChaoOptions{ CreateOptions: create.CreateOptions{ Factory: f, @@ -112,7 +112,7 @@ func NewNodeOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *Nod return o } -func NewNodeChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewNodeChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "node", Short: "Node chaos.", @@ -126,7 +126,7 @@ func NewNodeChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *co return cmd } -func NewStopCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewStopCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNodeOptions(f, streams) cmd := o.NewCobraCommand(Stop, StopShort) @@ -134,7 +134,7 @@ func NewStopCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C return cmd } -func NewRestartCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewRestartCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNodeOptions(f, streams) cmd := o.NewCobraCommand(Restart, RestartShort) @@ -142,7 +142,7 @@ func NewRestartCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobr return cmd } -func NewDetachVolumeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDetachVolumeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewNodeOptions(f, streams) cmd := o.NewCobraCommand(DetachVolume, DetachVolumeShort) diff --git a/internal/cli/cmd/fault/fault_node_test.go b/internal/cli/cmd/fault/fault_node_test.go index c9b6b978f09..f4703706ea3 100644 --- a/internal/cli/cmd/fault/fault_node_test.go +++ b/internal/cli/cmd/fault/fault_node_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -33,10 +33,10 @@ import ( var _ = Describe("Fault Node", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/fault_pod.go b/internal/cli/cmd/fault/fault_pod.go index 3a64aa580f7..919c806e6fb 100644 --- a/internal/cli/cmd/fault/fault_pod.go +++ b/internal/cli/cmd/fault/fault_pod.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -75,7 +75,7 @@ type PodChaosOptions struct { FaultBaseOptions } -func NewPodChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, action string) *PodChaosOptions { +func NewPodChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, action string) *PodChaosOptions { o := &PodChaosOptions{ FaultBaseOptions: FaultBaseOptions{ CreateOptions: create.CreateOptions{ @@ -92,7 +92,7 @@ func NewPodChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, return o } -func NewPodChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPodChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "pod", Short: "Pod chaos.", @@ -105,7 +105,7 @@ func NewPodChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cob return cmd } -func NewPodKillCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPodKillCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewPodChaosOptions(f, streams, string(v1alpha1.PodKillAction)) cmd := o.NewCobraCommand(Kill, KillShort) @@ -118,7 +118,7 @@ func NewPodKillCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobr return cmd } -func NewPodFailureCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPodFailureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewPodChaosOptions(f, streams, string(v1alpha1.PodFailureAction)) cmd := o.NewCobraCommand(Failure, FailureShort) @@ -129,7 +129,7 @@ func NewPodFailureCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *c return cmd } -func NewContainerKillCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewContainerKillCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewPodChaosOptions(f, streams, string(v1alpha1.ContainerKillAction)) cmd := o.NewCobraCommand(KillContainer, KillContainerShort) diff --git a/internal/cli/cmd/fault/fault_pod_test.go b/internal/cli/cmd/fault/fault_pod_test.go index b1e55d3b89c..3fe93582b35 100644 --- a/internal/cli/cmd/fault/fault_pod_test.go +++ b/internal/cli/cmd/fault/fault_pod_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/chaos-mesh/chaos-mesh/api/v1alpha1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -34,10 +34,10 @@ import ( var _ = Describe("Fault POD", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/fault_stress.go b/internal/cli/cmd/fault/fault_stress.go index 6e1cc932b89..76e0d169ec6 100644 --- a/internal/cli/cmd/fault/fault_stress.go +++ b/internal/cli/cmd/fault/fault_stress.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -66,7 +66,7 @@ type StressChaosOptions struct { FaultBaseOptions } -func NewStressChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, action string) *StressChaosOptions { +func NewStressChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, action string) *StressChaosOptions { o := &StressChaosOptions{ FaultBaseOptions: FaultBaseOptions{ CreateOptions: create.CreateOptions{ @@ -83,7 +83,7 @@ func NewStressChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStream return o } -func NewStressChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewStressChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewStressChaosOptions(f, streams, "") cmd := o.NewCobraCommand(Stress, StressShort) diff --git a/internal/cli/cmd/fault/fault_stress_test.go b/internal/cli/cmd/fault/fault_stress_test.go index 533527f74c7..19a3e33cf62 100644 --- a/internal/cli/cmd/fault/fault_stress_test.go +++ b/internal/cli/cmd/fault/fault_stress_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -33,10 +33,10 @@ import ( var _ = Describe("Fault Stress", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/fault_time.go b/internal/cli/cmd/fault/fault_time.go index 42950aa4166..287569e5c23 100644 --- a/internal/cli/cmd/fault/fault_time.go +++ b/internal/cli/cmd/fault/fault_time.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -59,7 +59,7 @@ type TimeChaosOptions struct { FaultBaseOptions } -func NewTimeChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, action string) *TimeChaosOptions { +func NewTimeChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, action string) *TimeChaosOptions { o := &TimeChaosOptions{ FaultBaseOptions: FaultBaseOptions{ CreateOptions: create.CreateOptions{ @@ -76,7 +76,7 @@ func NewTimeChaosOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, return o } -func NewTimeChaosCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewTimeChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewTimeChaosOptions(f, streams, "") cmd := o.NewCobraCommand(Time, TimeShort) diff --git a/internal/cli/cmd/fault/fault_time_test.go b/internal/cli/cmd/fault/fault_time_test.go index ef6b108f799..b5e6832a185 100644 --- a/internal/cli/cmd/fault/fault_time_test.go +++ b/internal/cli/cmd/fault/fault_time_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -33,10 +33,10 @@ import ( var _ = Describe("Fault Time", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/fault/list_and_delete.go b/internal/cli/cmd/fault/list_and_delete.go index 6dc1165da3d..a9b292ef086 100644 --- a/internal/cli/cmd/fault/list_and_delete.go +++ b/internal/cli/cmd/fault/list_and_delete.go @@ -30,7 +30,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -66,10 +66,10 @@ type ListAndDeleteOptions struct { AllResourceKinds []string Kind bool - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &ListAndDeleteOptions{Factory: f, IOStreams: streams} cmd := cobra.Command{ Use: "list", @@ -85,7 +85,7 @@ func NewListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C return &cmd } -func NewDeleteCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDeleteCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &ListAndDeleteOptions{Factory: f, IOStreams: streams} return &cobra.Command{ Use: "delete", diff --git a/internal/cli/cmd/fault/list_and_delete_test.go b/internal/cli/cmd/fault/list_and_delete_test.go index 2ac03822fa7..e524b19c696 100644 --- a/internal/cli/cmd/fault/list_and_delete_test.go +++ b/internal/cli/cmd/fault/list_and_delete_test.go @@ -28,7 +28,7 @@ import ( "github.com/chaos-mesh/chaos-mesh/api/v1alpha1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/dynamic/fake" "k8s.io/client-go/kubernetes/scheme" @@ -41,14 +41,14 @@ import ( var _ = Describe("Chaos resources list and delete", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams namespace = "test" podChaosName = "testPodChaos" podChaos = testing.FakePodChaos(podChaosName, namespace) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/infrastructure/cluster.go b/internal/cli/cmd/infrastructure/cluster.go index a80020026c4..671bfa72db0 100644 --- a/internal/cli/cmd/infrastructure/cluster.go +++ b/internal/cli/cmd/infrastructure/cluster.go @@ -32,7 +32,7 @@ import ( "github.com/spf13/cobra" "golang.org/x/exp/slices" "k8s.io/apimachinery/pkg/util/rand" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "github.com/apecloud/kubeblocks/internal/cli/cmd/infrastructure/builder" "github.com/apecloud/kubeblocks/internal/cli/cmd/infrastructure/types" @@ -44,7 +44,7 @@ import ( type clusterOptions struct { types.Cluster - IOStreams genericclioptions.IOStreams + IOStreams genericiooptions.IOStreams clusterConfig string clusterName string diff --git a/internal/cli/cmd/infrastructure/create.go b/internal/cli/cmd/infrastructure/create.go index 1a6d2706c1d..ea264075a65 100644 --- a/internal/cli/cmd/infrastructure/create.go +++ b/internal/cli/cmd/infrastructure/create.go @@ -27,7 +27,7 @@ import ( "github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/connector" "github.com/spf13/cobra" versionutil "k8s.io/apimachinery/pkg/util/version" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/kubectl/pkg/util/templates" "github.com/apecloud/kubeblocks/internal/cli/cmd/infrastructure/constant" @@ -169,7 +169,7 @@ func checkAndUpdateZone() { fmt.Printf("current zone: %s\n", os.Getenv(ZoneName)) } -func NewCreateKubernetesCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewCreateKubernetesCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &createOptions{ clusterOptions: clusterOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/infrastructure/create_test.go b/internal/cli/cmd/infrastructure/create_test.go index 85593f929bb..1f2f9fa4d1b 100644 --- a/internal/cli/cmd/infrastructure/create_test.go +++ b/internal/cli/cmd/infrastructure/create_test.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "github.com/apecloud/kubeblocks/internal/cli/testing" @@ -37,11 +37,11 @@ var _ = Describe("infra create test", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) }) diff --git a/internal/cli/cmd/infrastructure/delete.go b/internal/cli/cmd/infrastructure/delete.go index 62bbeba59e3..7639bc8e95b 100644 --- a/internal/cli/cmd/infrastructure/delete.go +++ b/internal/cli/cmd/infrastructure/delete.go @@ -26,7 +26,7 @@ import ( "github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/connector" "github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/pipeline" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/kubectl/pkg/util/templates" "github.com/apecloud/kubeblocks/internal/cli/util" @@ -97,7 +97,7 @@ func (o *deleteOptions) buildDeleteInfraFlags(cmd *cobra.Command) { cmd.Flags().BoolVarP(&o.deleteCRI, "delete-cri", "", false, "delete cri") } -func NewDeleteKubernetesCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewDeleteKubernetesCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &deleteOptions{ clusterOptions: clusterOptions{ IOStreams: streams, diff --git a/internal/cli/cmd/infrastructure/infras.go b/internal/cli/cmd/infrastructure/infras.go index f47465f4ee3..8a46a069239 100644 --- a/internal/cli/cmd/infrastructure/infras.go +++ b/internal/cli/cmd/infrastructure/infras.go @@ -21,11 +21,11 @@ package infrastructure import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) // NewInfraCmd for builder functions -func NewInfraCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewInfraCmd(streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "infra", Short: "infra command", diff --git a/internal/cli/cmd/infrastructure/infras_test.go b/internal/cli/cmd/infrastructure/infras_test.go index e7307b7e189..81639840677 100644 --- a/internal/cli/cmd/infrastructure/infras_test.go +++ b/internal/cli/cmd/infrastructure/infras_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) var _ = Describe("kubeblock infra", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() }) AfterEach(func() { diff --git a/internal/cli/cmd/kubeblocks/compare.go b/internal/cli/cmd/kubeblocks/compare.go index af17ce731aa..80ed4e3cb0a 100644 --- a/internal/cli/cmd/kubeblocks/compare.go +++ b/internal/cli/cmd/kubeblocks/compare.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "helm.sh/helm/v3/pkg/repo" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -42,7 +42,7 @@ var ( kbcli kubeblocks compare 0.4.0 0.5.0`) ) -func newCompareCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newCompareCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &InstallOptions{ Options: Options{ IOStreams: streams, diff --git a/internal/cli/cmd/kubeblocks/compare_test.go b/internal/cli/cmd/kubeblocks/compare_test.go index 4173ad7f953..9520b0391ac 100644 --- a/internal/cli/cmd/kubeblocks/compare_test.go +++ b/internal/cli/cmd/kubeblocks/compare_test.go @@ -22,8 +22,9 @@ package kubeblocks import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -34,13 +35,13 @@ import ( var _ = Describe("kubeblocks compare", func() { var ( cmd *cobra.Command - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) const kbVersion = "0.5.0" BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/kubeblocks/config.go b/internal/cli/cmd/kubeblocks/config.go index a19286d0551..c7b750d9e12 100644 --- a/internal/cli/cmd/kubeblocks/config.go +++ b/internal/cli/cmd/kubeblocks/config.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -95,7 +95,7 @@ var describeConfigExample = templates.Examples(` `) // NewConfigCmd creates the config command -func NewConfigCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewConfigCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &InstallOptions{ Options: Options{ IOStreams: streams, @@ -118,7 +118,7 @@ func NewConfigCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra return cmd } -func NewDescribeConfigCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewDescribeConfigCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &InstallOptions{ Options: Options{ IOStreams: streams, diff --git a/internal/cli/cmd/kubeblocks/config_test.go b/internal/cli/cmd/kubeblocks/config_test.go index 3591d70af97..bde1fc3890c 100644 --- a/internal/cli/cmd/kubeblocks/config_test.go +++ b/internal/cli/cmd/kubeblocks/config_test.go @@ -29,7 +29,7 @@ import ( "helm.sh/helm/v3/pkg/cli/values" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -41,7 +41,7 @@ import ( ) var _ = Describe("backupconfig", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory var o *InstallOptions var out *bytes.Buffer @@ -105,7 +105,7 @@ var _ = Describe("backupconfig", func() { } BeforeEach(func() { - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} // use a fake URL to test diff --git a/internal/cli/cmd/kubeblocks/install.go b/internal/cli/cmd/kubeblocks/install.go index b714bfd5ed4..37bc235a031 100644 --- a/internal/cli/cmd/kubeblocks/install.go +++ b/internal/cli/cmd/kubeblocks/install.go @@ -38,7 +38,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" @@ -61,7 +61,7 @@ const ( ) type Options struct { - genericclioptions.IOStreams + genericiooptions.IOStreams HelmCfg *helm.Config @@ -119,7 +119,7 @@ var ( } ) -func newInstallCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newInstallCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &InstallOptions{ Options: Options{ IOStreams: streams, diff --git a/internal/cli/cmd/kubeblocks/install_test.go b/internal/cli/cmd/kubeblocks/install_test.go index d9a56953437..bbda4eb7216 100644 --- a/internal/cli/cmd/kubeblocks/install_test.go +++ b/internal/cli/cmd/kubeblocks/install_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -39,12 +39,12 @@ const namespace = "test" var _ = Describe("kubeblocks install", func() { var ( cmd *cobra.Command - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} }) @@ -95,7 +95,7 @@ var _ = Describe("kubeblocks install", func() { It("checkVersion", func() { o := &InstallOptions{ Options: Options{ - IOStreams: genericclioptions.NewTestIOStreamsDiscard(), + IOStreams: genericiooptions.NewTestIOStreamsDiscard(), Client: testing.FakeClientSet(), }, Check: true, diff --git a/internal/cli/cmd/kubeblocks/kubeblocks.go b/internal/cli/cmd/kubeblocks/kubeblocks.go index b83fe78360b..b859cd7e9bc 100644 --- a/internal/cli/cmd/kubeblocks/kubeblocks.go +++ b/internal/cli/cmd/kubeblocks/kubeblocks.go @@ -21,12 +21,12 @@ package kubeblocks import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" ) // NewKubeBlocksCmd creates the kubeblocks command -func NewKubeBlocksCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewKubeBlocksCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "kubeblocks [install | upgrade | list-versions | uninstall]", Short: "KubeBlocks operation commands.", diff --git a/internal/cli/cmd/kubeblocks/kubeblocks_test.go b/internal/cli/cmd/kubeblocks/kubeblocks_test.go index 002619112b0..7a2a5fc2a42 100644 --- a/internal/cli/cmd/kubeblocks/kubeblocks_test.go +++ b/internal/cli/cmd/kubeblocks/kubeblocks_test.go @@ -22,19 +22,20 @@ package kubeblocks import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("kubeblocks", func() { var cmd *cobra.Command - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/kubeblocks/list_versions.go b/internal/cli/cmd/kubeblocks/list_versions.go index 4e7750dbc6b..c45a72e8c9a 100644 --- a/internal/cli/cmd/kubeblocks/list_versions.go +++ b/internal/cli/cmd/kubeblocks/list_versions.go @@ -26,7 +26,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/pkg/errors" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/kubectl/pkg/util/templates" "github.com/apecloud/kubeblocks/internal/cli/printer" @@ -48,13 +48,13 @@ var ( ) type listVersionsOption struct { - genericclioptions.IOStreams + genericiooptions.IOStreams version string devel bool limit int } -func newListVersionsCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newListVersionsCmd(streams genericiooptions.IOStreams) *cobra.Command { o := listVersionsOption{IOStreams: streams} cmd := &cobra.Command{ Use: "list-versions", diff --git a/internal/cli/cmd/kubeblocks/list_versions_test.go b/internal/cli/cmd/kubeblocks/list_versions_test.go index 9dc0f208694..6bcf6f55f13 100644 --- a/internal/cli/cmd/kubeblocks/list_versions_test.go +++ b/internal/cli/cmd/kubeblocks/list_versions_test.go @@ -25,18 +25,18 @@ import ( "github.com/Masterminds/semver/v3" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("kubeblocks list versions", func() { var cmd *cobra.Command - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/kubeblocks/preflight.go b/internal/cli/cmd/kubeblocks/preflight.go index 03e8aedeb0c..cba08f8bdf1 100644 --- a/internal/cli/cmd/kubeblocks/preflight.go +++ b/internal/cli/cmd/kubeblocks/preflight.go @@ -33,7 +33,7 @@ import ( "github.com/spf13/cobra" "golang.org/x/sync/errgroup" "helm.sh/helm/v3/pkg/cli/values" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/rest" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -87,7 +87,7 @@ var ( // PreflightOptions declares the arguments accepted by the preflight command type PreflightOptions struct { factory cmdutil.Factory - genericclioptions.IOStreams + genericiooptions.IOStreams *preflight.PreflightFlags checkFileList []string checkYamlData [][]byte @@ -97,7 +97,7 @@ type PreflightOptions struct { ValueOpts values.Options } -func NewPreflightCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewPreflightCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { p := &PreflightOptions{ factory: f, IOStreams: streams, diff --git a/internal/cli/cmd/kubeblocks/preflight_test.go b/internal/cli/cmd/kubeblocks/preflight_test.go index f70f7328072..ae62b5145bc 100644 --- a/internal/cli/cmd/kubeblocks/preflight_test.go +++ b/internal/cli/cmd/kubeblocks/preflight_test.go @@ -28,7 +28,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -46,14 +46,14 @@ var _ = Describe("Preflight API Test", func() { ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory cluster = testing.FakeCluster(clusterName, namespace) pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/cli/cmd/kubeblocks/status.go b/internal/cli/cmd/kubeblocks/status.go index 526d37eeac8..5003946cc10 100644 --- a/internal/cli/cmd/kubeblocks/status.go +++ b/internal/cli/cmd/kubeblocks/status.go @@ -36,7 +36,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" @@ -105,7 +105,7 @@ var ( ) type statusOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams client kubernetes.Interface dynamic dynamic.Interface mc metrics.Interface @@ -115,7 +115,7 @@ type statusOptions struct { selectorList []metav1.ListOptions } -func newStatusCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newStatusCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := statusOptions{IOStreams: streams} cmd := &cobra.Command{ Use: "status", diff --git a/internal/cli/cmd/kubeblocks/status_test.go b/internal/cli/cmd/kubeblocks/status_test.go index 8d1beec8ab8..2951227b112 100644 --- a/internal/cli/cmd/kubeblocks/status_test.go +++ b/internal/cli/cmd/kubeblocks/status_test.go @@ -36,7 +36,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/version" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -51,7 +51,7 @@ import ( var _ = Describe("kubeblocks status", func() { var ( namespace = "test" - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory stsName = "test-sts" deployName = "test-deploy" @@ -115,7 +115,7 @@ var _ = Describe("kubeblocks status", func() { tf.Client = tf.UnstructuredClient tf.FakeDynamicClient = testing.FakeDynamicClient(deploy, sts) - streams = genericclioptions.NewTestIOStreamsDiscard() + streams = genericiooptions.NewTestIOStreamsDiscard() }) AfterEach(func() { diff --git a/internal/cli/cmd/kubeblocks/uninstall.go b/internal/cli/cmd/kubeblocks/uninstall.go index 3419629e9ed..71da956e0c8 100644 --- a/internal/cli/cmd/kubeblocks/uninstall.go +++ b/internal/cli/cmd/kubeblocks/uninstall.go @@ -38,7 +38,7 @@ import ( k8sapitypes "k8s.io/apimachinery/pkg/types" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -72,7 +72,7 @@ type UninstallOptions struct { force bool } -func newUninstallCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newUninstallCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &UninstallOptions{ Options: Options{ IOStreams: streams, diff --git a/internal/cli/cmd/kubeblocks/uninstall_test.go b/internal/cli/cmd/kubeblocks/uninstall_test.go index b04ab7bb47e..db65bbc3343 100644 --- a/internal/cli/cmd/kubeblocks/uninstall_test.go +++ b/internal/cli/cmd/kubeblocks/uninstall_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -34,11 +34,11 @@ import ( var _ = Describe("kubeblocks uninstall", func() { var cmd *cobra.Command - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/kubeblocks/upgrade.go b/internal/cli/cmd/kubeblocks/upgrade.go index 667ce1d5c13..3a70b8b851a 100644 --- a/internal/cli/cmd/kubeblocks/upgrade.go +++ b/internal/cli/cmd/kubeblocks/upgrade.go @@ -30,7 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -52,7 +52,7 @@ var ( kbcli kubeblocks upgrade --set replicaCount=3`) ) -func newUpgradeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newUpgradeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &InstallOptions{ Options: Options{ IOStreams: streams, diff --git a/internal/cli/cmd/kubeblocks/upgrade_test.go b/internal/cli/cmd/kubeblocks/upgrade_test.go index 4dabe696c8a..527efe8bb4a 100644 --- a/internal/cli/cmd/kubeblocks/upgrade_test.go +++ b/internal/cli/cmd/kubeblocks/upgrade_test.go @@ -25,7 +25,7 @@ import ( "github.com/spf13/cobra" appsv1 "k8s.io/api/apps/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -37,11 +37,11 @@ import ( var _ = Describe("kubeblocks upgrade", func() { var cmd *cobra.Command - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/cmd/migration/cmd_builder.go b/internal/cli/cmd/migration/cmd_builder.go index 57d276b84c8..f5d3d6164b0 100644 --- a/internal/cli/cmd/migration/cmd_builder.go +++ b/internal/cli/cmd/migration/cmd_builder.go @@ -21,13 +21,13 @@ package migration import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" ) // NewMigrationCmd creates the cluster command -func NewMigrationCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrationCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "migration", Short: "Data migration between two data sources.", diff --git a/internal/cli/cmd/migration/cmd_builder_test.go b/internal/cli/cmd/migration/cmd_builder_test.go index dc1105d2694..051b7bc2069 100644 --- a/internal/cli/cmd/migration/cmd_builder_test.go +++ b/internal/cli/cmd/migration/cmd_builder_test.go @@ -23,14 +23,13 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("cmd_builder", func() { - var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) diff --git a/internal/cli/cmd/migration/create.go b/internal/cli/cmd/migration/create.go index a559dd2239f..1657c8b6426 100644 --- a/internal/cli/cmd/migration/create.go +++ b/internal/cli/cmd/migration/create.go @@ -27,7 +27,7 @@ import ( "github.com/spf13/cobra" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/rand" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "github.com/apecloud/kubeblocks/internal/cli/create" @@ -70,7 +70,7 @@ type CreateMigrationOptions struct { create.CreateOptions `json:"-"` } -func NewMigrationCreateCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrationCreateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &CreateMigrationOptions{ CreateOptions: create.CreateOptions{ Factory: f, diff --git a/internal/cli/cmd/migration/create_test.go b/internal/cli/cmd/migration/create_test.go index 1c74568522e..32bd00ba201 100644 --- a/internal/cli/cmd/migration/create_test.go +++ b/internal/cli/cmd/migration/create_test.go @@ -25,7 +25,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes/scheme" cmdTest "k8s.io/kubectl/pkg/cmd/testing" @@ -35,7 +35,7 @@ import ( ) var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams out *bytes.Buffer tf *cmdTest.TestFactory ) @@ -48,7 +48,7 @@ var _ = Describe("create", func() { o := &CreateMigrationOptions{} BeforeEach(func() { - streams, _, out, _ = genericclioptions.NewTestIOStreams() + streams, _, out, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) _ = app.AddToScheme(scheme.Scheme) diff --git a/internal/cli/cmd/migration/describe.go b/internal/cli/cmd/migration/describe.go index c9b835d5c4b..d70679cf08b 100644 --- a/internal/cli/cmd/migration/describe.go +++ b/internal/cli/cmd/migration/describe.go @@ -34,7 +34,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" clientset "k8s.io/client-go/kubernetes" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -65,10 +65,10 @@ type describeOptions struct { names []string *v1alpha1.MigrationObjects - genericclioptions.IOStreams + genericiooptions.IOStreams } -func newOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *describeOptions { +func newOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *describeOptions { return &describeOptions{ factory: f, IOStreams: streams, @@ -76,7 +76,7 @@ func newOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *describ } } -func NewMigrationDescribeCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrationDescribeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := newOptions(f, streams) cmd := &cobra.Command{ Use: "describe NAME", diff --git a/internal/cli/cmd/migration/describe_test.go b/internal/cli/cmd/migration/describe_test.go index 1ce4890cd12..a68c2927f3c 100644 --- a/internal/cli/cmd/migration/describe_test.go +++ b/internal/cli/cmd/migration/describe_test.go @@ -28,14 +28,14 @@ import ( appv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("describe", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) diff --git a/internal/cli/cmd/migration/list.go b/internal/cli/cmd/migration/list.go index 958b31df2a7..c3304964529 100644 --- a/internal/cli/cmd/migration/list.go +++ b/internal/cli/cmd/migration/list.go @@ -21,7 +21,7 @@ package migration import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "github.com/apecloud/kubeblocks/internal/cli/list" @@ -29,7 +29,7 @@ import ( "github.com/apecloud/kubeblocks/internal/cli/util" ) -func NewMigrationListCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrationListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.MigrationTaskGVR()) cmd := &cobra.Command{ Use: "list [NAME]", diff --git a/internal/cli/cmd/migration/list_test.go b/internal/cli/cmd/migration/list_test.go index 01be8a3b61c..7661d9ae876 100644 --- a/internal/cli/cmd/migration/list_test.go +++ b/internal/cli/cmd/migration/list_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("list", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) diff --git a/internal/cli/cmd/migration/logs.go b/internal/cli/cmd/migration/logs.go index fe5ec056b09..44b47425b91 100644 --- a/internal/cli/cmd/migration/logs.go +++ b/internal/cli/cmd/migration/logs.go @@ -29,7 +29,7 @@ import ( "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" cmdlogs "k8s.io/kubectl/pkg/cmd/logs" @@ -51,7 +51,7 @@ type LogsOptions struct { logOptions cmdlogs.LogsOptions } -func NewMigrationLogsCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrationLogsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { l := &LogsOptions{ ExecOptions: exec.NewExecOptions(f, streams), logOptions: cmdlogs.LogsOptions{ diff --git a/internal/cli/cmd/migration/logs_test.go b/internal/cli/cmd/migration/logs_test.go index d97bb04efc8..2630e10f9db 100644 --- a/internal/cli/cmd/migration/logs_test.go +++ b/internal/cli/cmd/migration/logs_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("logs", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) diff --git a/internal/cli/cmd/migration/templates.go b/internal/cli/cmd/migration/templates.go index 89163507ef1..c7d98eba492 100644 --- a/internal/cli/cmd/migration/templates.go +++ b/internal/cli/cmd/migration/templates.go @@ -21,7 +21,7 @@ package migration import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "github.com/apecloud/kubeblocks/internal/cli/list" @@ -29,7 +29,7 @@ import ( "github.com/apecloud/kubeblocks/internal/cli/util" ) -func NewMigrationTemplatesCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrationTemplatesCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := list.NewListOptions(f, streams, types.MigrationTemplateGVR()) cmd := &cobra.Command{ Use: "templates [NAME]", diff --git a/internal/cli/cmd/migration/templates_test.go b/internal/cli/cmd/migration/templates_test.go index b7e5662a463..1bf10d97880 100644 --- a/internal/cli/cmd/migration/templates_test.go +++ b/internal/cli/cmd/migration/templates_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("templates", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) diff --git a/internal/cli/cmd/migration/terminate.go b/internal/cli/cmd/migration/terminate.go index 7b599e77263..05431d4af3b 100644 --- a/internal/cli/cmd/migration/terminate.go +++ b/internal/cli/cmd/migration/terminate.go @@ -23,7 +23,7 @@ import ( "fmt" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "github.com/apecloud/kubeblocks/internal/cli/delete" @@ -31,7 +31,7 @@ import ( "github.com/apecloud/kubeblocks/internal/cli/util" ) -func NewMigrationTerminateCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewMigrationTerminateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := delete.NewDeleteOptions(f, streams, types.MigrationTaskGVR()) cmd := &cobra.Command{ Use: "terminate NAME", diff --git a/internal/cli/cmd/migration/terminate_test.go b/internal/cli/cmd/migration/terminate_test.go index bb443343a73..43bde5d80a7 100644 --- a/internal/cli/cmd/migration/terminate_test.go +++ b/internal/cli/cmd/migration/terminate_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" ) var _ = Describe("terminate", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) diff --git a/internal/cli/cmd/organization/organization.go b/internal/cli/cmd/organization/organization.go index 32c2b73b520..65dacf26591 100644 --- a/internal/cli/cmd/organization/organization.go +++ b/internal/cli/cmd/organization/organization.go @@ -28,7 +28,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" "gopkg.in/yaml.v2" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -85,16 +85,16 @@ type OrganizationOption struct { OutputFormat string Organization Organization - genericclioptions.IOStreams + genericiooptions.IOStreams } -func newOrganizationOption(streams genericclioptions.IOStreams) *OrganizationOption { +func newOrganizationOption(streams genericiooptions.IOStreams) *OrganizationOption { return &OrganizationOption{ IOStreams: streams, } } -func NewOrganizationCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewOrganizationCmd(streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "org", Short: "kbcli org is used to manage cloud organizations and is only suitable for interacting with cloud.", @@ -110,7 +110,7 @@ func NewOrganizationCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newOrgListCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newOrgListCmd(streams genericiooptions.IOStreams) *cobra.Command { o := newOrganizationOption(streams) cmd := &cobra.Command{ @@ -126,7 +126,7 @@ func newOrgListCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newOrgSwitchCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newOrgSwitchCmd(streams genericiooptions.IOStreams) *cobra.Command { o := newOrganizationOption(streams) cmd := &cobra.Command{ @@ -142,7 +142,7 @@ func newOrgSwitchCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newOrgCurrentCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newOrgCurrentCmd(streams genericiooptions.IOStreams) *cobra.Command { o := newOrganizationOption(streams) cmd := &cobra.Command{ @@ -158,7 +158,7 @@ func newOrgCurrentCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func newOrgDescribeCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newOrgDescribeCmd(streams genericiooptions.IOStreams) *cobra.Command { o := newOrganizationOption(streams) cmd := &cobra.Command{ diff --git a/internal/cli/cmd/organization/organization_test.go b/internal/cli/cmd/organization/organization_test.go index 0e255d0eaa7..d680dcc69f7 100644 --- a/internal/cli/cmd/organization/organization_test.go +++ b/internal/cli/cmd/organization/organization_test.go @@ -26,11 +26,11 @@ import ( "fmt" "os" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) type MockOrganization struct { - genericclioptions.IOStreams + genericiooptions.IOStreams } func (m *MockOrganization) getOrganization(name string) (*OrgItem, error) { @@ -86,11 +86,11 @@ func (m *MockOrganization) IsValidOrganization(name string) (bool, error) { var _ = Describe("Test Organization", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams o *OrganizationOption ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() o = &OrganizationOption{IOStreams: streams, Organization: &MockOrganization{}} os.Setenv("TEST_ENV", "true") }) diff --git a/internal/cli/cmd/playground/destroy.go b/internal/cli/cmd/playground/destroy.go index 3f8a7b71e88..e2ac26d2b10 100644 --- a/internal/cli/cmd/playground/destroy.go +++ b/internal/cli/cmd/playground/destroy.go @@ -32,7 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" apitypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" @@ -57,7 +57,7 @@ var ( ) type destroyOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams baseOptions // purge resources, before destroying kubernetes cluster we should delete cluster and @@ -68,7 +68,7 @@ type destroyOptions struct { timeout time.Duration } -func newDestroyCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newDestroyCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &destroyOptions{ IOStreams: streams, } @@ -298,14 +298,15 @@ func (o *destroyOptions) deleteClusters(dynamic dynamic.Interface) error { // check all clusters termination policy is WipeOut if checkWipeOut { - if err = wait.PollImmediate(5*time.Second, o.timeout, func() (bool, error) { - return checkClusters(func(cluster *appsv1alpha1.Cluster) bool { - if cluster.Spec.TerminationPolicy != appsv1alpha1.WipeOut { - klog.V(1).Infof("Cluster %s termination policy is %s", cluster.Name, cluster.Spec.TerminationPolicy) - } - return cluster.Spec.TerminationPolicy == appsv1alpha1.WipeOut - }) - }); err != nil { + if err = wait.PollUntilContextTimeout(context.Background(), 5*time.Second, + o.timeout, true, func(_ context.Context) (bool, error) { + return checkClusters(func(cluster *appsv1alpha1.Cluster) bool { + if cluster.Spec.TerminationPolicy != appsv1alpha1.WipeOut { + klog.V(1).Infof("Cluster %s termination policy is %s", cluster.Name, cluster.Spec.TerminationPolicy) + } + return cluster.Spec.TerminationPolicy == appsv1alpha1.WipeOut + }) + }); err != nil { return err } } @@ -316,13 +317,14 @@ func (o *destroyOptions) deleteClusters(dynamic dynamic.Interface) error { } // check and wait all clusters are deleted - if err = wait.PollImmediate(5*time.Second, o.timeout, func() (bool, error) { - return checkClusters(func(cluster *appsv1alpha1.Cluster) bool { - // always return false if any cluster is not deleted - klog.V(1).Infof("Cluster %s is not deleted", cluster.Name) - return false - }) - }); err != nil { + if err = wait.PollUntilContextTimeout(context.Background(), 5*time.Second, + o.timeout, true, func(_ context.Context) (bool, error) { + return checkClusters(func(cluster *appsv1alpha1.Cluster) bool { + // always return false if any cluster is not deleted + klog.V(1).Infof("Cluster %s is not deleted", cluster.Name) + return false + }) + }); err != nil { return err } diff --git a/internal/cli/cmd/playground/destroy_test.go b/internal/cli/cmd/playground/destroy_test.go index 0cfb5c81980..13692cd3ab9 100644 --- a/internal/cli/cmd/playground/destroy_test.go +++ b/internal/cli/cmd/playground/destroy_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) var _ = Describe("playground destroy", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() }) It("destroy command", func() { diff --git a/internal/cli/cmd/playground/init.go b/internal/cli/cmd/playground/init.go index 731ceb6611a..c6cc1002f99 100644 --- a/internal/cli/cmd/playground/init.go +++ b/internal/cli/cmd/playground/init.go @@ -32,7 +32,7 @@ import ( "golang.org/x/exp/slices" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/util/rand" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -96,7 +96,7 @@ on the created kubernetes cluster, and an apecloud-mysql cluster named mycluster ) type initOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams helmCfg *helm.Config clusterDef string kbVersion string @@ -109,7 +109,7 @@ type initOptions struct { baseOptions } -func newInitCmd(streams genericclioptions.IOStreams) *cobra.Command { +func newInitCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &initOptions{ IOStreams: streams, } @@ -503,7 +503,7 @@ func (o *initOptions) installKubeBlocks(k8sClusterName string) error { // createCluster constructs a cluster create options and run func (o *initOptions) createCluster() error { - c := cmdcluster.NewCreateOptions(util.NewFactory(), genericclioptions.NewTestIOStreamsDiscard()) + c := cmdcluster.NewCreateOptions(util.NewFactory(), genericiooptions.NewTestIOStreamsDiscard()) c.ClusterDefRef = o.clusterDef c.ClusterVersionRef = o.clusterVersion c.Namespace = defaultNamespace diff --git a/internal/cli/cmd/playground/init_test.go b/internal/cli/cmd/playground/init_test.go index 528846742f8..2b10cef47a2 100644 --- a/internal/cli/cmd/playground/init_test.go +++ b/internal/cli/cmd/playground/init_test.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/gomega" gv "github.com/hashicorp/go-version" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cp "github.com/apecloud/kubeblocks/internal/cli/cloudprovider" clitesting "github.com/apecloud/kubeblocks/internal/cli/testing" @@ -40,10 +40,10 @@ var _ = Describe("playground", func() { testKubeConfigPath = "./testdata/kubeconfig" ) - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() Expect(os.Setenv(types.CliHomeEnv, "./testdata")).Should(Succeed()) }) diff --git a/internal/cli/cmd/playground/palyground.go b/internal/cli/cmd/playground/palyground.go index 29d1906b8e7..cf359679712 100644 --- a/internal/cli/cmd/playground/palyground.go +++ b/internal/cli/cmd/playground/palyground.go @@ -21,11 +21,11 @@ package playground import ( "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) // NewPlaygroundCmd creates the playground command -func NewPlaygroundCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPlaygroundCmd(streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "playground [init | destroy]", Short: "Bootstrap or destroy a playground KubeBlocks in local host or cloud.", diff --git a/internal/cli/cmd/playground/playground_test.go b/internal/cli/cmd/playground/playground_test.go index 021e57abe25..ea585b64145 100644 --- a/internal/cli/cmd/playground/playground_test.go +++ b/internal/cli/cmd/playground/playground_test.go @@ -23,14 +23,14 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) var _ = Describe("playground", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() }) It("new playground command", func() { diff --git a/internal/cli/cmd/playground/util.go b/internal/cli/cmd/playground/util.go index 30880586c1c..f634617f22a 100644 --- a/internal/cli/cmd/playground/util.go +++ b/internal/cli/cmd/playground/util.go @@ -146,7 +146,7 @@ func getKubeClient() (kubernetes.Interface, dynamic.Interface, error) { f := util.NewFactory() client, err := f.KubernetesClientSet() errMsg := kubeClusterUnreachableErr.Error() - if err == genericclioptions.ErrEmptyConfig { + if errors.Is(err, genericclioptions.ErrEmptyConfig) { return nil, nil, kubeClusterUnreachableErr } if err != nil { diff --git a/internal/cli/cmd/plugin/describe.go b/internal/cli/cmd/plugin/describe.go index 0df572b3e5a..759e8feb82e 100644 --- a/internal/cli/cmd/plugin/describe.go +++ b/internal/cli/cmd/plugin/describe.go @@ -24,7 +24,7 @@ import ( "io" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" ) @@ -37,7 +37,7 @@ var pluginDescribeExample = templates.Examples(` kbcli plugin describe [INDEX/PLUGIN] `) -func NewPluginDescribeCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginDescribeCmd(streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "describe", Short: "Describe a plugin", diff --git a/internal/cli/cmd/plugin/index.go b/internal/cli/cmd/plugin/index.go index 8e8def42d70..f6816a83a7b 100644 --- a/internal/cli/cmd/plugin/index.go +++ b/internal/cli/cmd/plugin/index.go @@ -26,7 +26,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -52,7 +52,7 @@ var ( `) ) -func NewPluginIndexCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginIndexCmd(streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "index", Short: "Manage custom plugin indexes", @@ -70,7 +70,7 @@ type PluginIndexOptions struct { IndexName string URL string - genericclioptions.IOStreams + genericiooptions.IOStreams } func (o *PluginIndexOptions) ListIndex() error { @@ -124,7 +124,7 @@ func (o *PluginIndexOptions) UpdateIndex() error { return nil } -func NewPluginIndexListCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginIndexListCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &PluginIndexOptions{ IOStreams: streams, } @@ -141,7 +141,7 @@ func NewPluginIndexListCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func NewPluginIndexAddCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginIndexAddCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &PluginIndexOptions{ IOStreams: streams, } @@ -161,7 +161,7 @@ func NewPluginIndexAddCmd(streams genericclioptions.IOStreams) *cobra.Command { return cmd } -func NewPluginIndexDeleteCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginIndexDeleteCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &PluginIndexOptions{ IOStreams: streams, } @@ -180,7 +180,7 @@ func NewPluginIndexDeleteCmd(streams genericclioptions.IOStreams) *cobra.Command return cmd } -func NewPluginIndexUpdateCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginIndexUpdateCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &PluginIndexOptions{ IOStreams: streams, } diff --git a/internal/cli/cmd/plugin/install.go b/internal/cli/cmd/plugin/install.go index 2a7098cef42..0bda622547f 100755 --- a/internal/cli/cmd/plugin/install.go +++ b/internal/cli/cmd/plugin/install.go @@ -27,7 +27,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -48,7 +48,7 @@ var ( type PluginInstallOption struct { plugins []pluginEntry - genericclioptions.IOStreams + genericiooptions.IOStreams } type pluginEntry struct { @@ -56,7 +56,7 @@ type pluginEntry struct { plugin Plugin } -func NewPluginInstallCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginInstallCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &PluginInstallOption{ IOStreams: streams, } diff --git a/internal/cli/cmd/plugin/plugin.go b/internal/cli/cmd/plugin/plugin.go index 8dba6979ea4..03c47927f1e 100644 --- a/internal/cli/cmd/plugin/plugin.go +++ b/internal/cli/cmd/plugin/plugin.go @@ -28,7 +28,7 @@ import ( "strings" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -53,7 +53,7 @@ var ( paths = GetKbcliPluginPath() ) -func NewPluginCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginCmd(streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "plugin", Short: "Provides utilities for interacting with plugins.", @@ -80,10 +80,10 @@ type PluginListOptions struct { PluginPaths []string - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewPluginListCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginListCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &PluginListOptions{ IOStreams: streams, } diff --git a/internal/cli/cmd/plugin/plugin_test.go b/internal/cli/cmd/plugin/plugin_test.go index b93448e2817..139b8008326 100644 --- a/internal/cli/cmd/plugin/plugin_test.go +++ b/internal/cli/cmd/plugin/plugin_test.go @@ -27,7 +27,7 @@ import ( "strings" "testing" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" ) func TestPluginPathsAreUnaltered(t *testing.T) { @@ -49,7 +49,7 @@ func TestPluginPathsAreUnaltered(t *testing.T) { } }() - ioStreams, _, _, errOut := genericclioptions.NewTestIOStreams() + ioStreams, _, _, errOut := genericiooptions.NewTestIOStreams() verifier := newFakePluginPathVerifier() pluginPaths := []string{tempDir1, tempDir2} o := &PluginListOptions{ @@ -136,7 +136,7 @@ func TestPluginPathsAreValid(t *testing.T) { for _, test := range tc { t.Run(test.name, func(t *testing.T) { - ioStreams, _, out, errOut := genericclioptions.NewTestIOStreams() + ioStreams, _, out, errOut := genericiooptions.NewTestIOStreams() o := &PluginListOptions{ Verifier: test.verifier, IOStreams: ioStreams, @@ -192,7 +192,7 @@ func TestListPlugins(t *testing.T) { } verifier := newFakePluginPathVerifier() - ioStreams, _, _, _ := genericclioptions.NewTestIOStreams() + ioStreams, _, _, _ := genericiooptions.NewTestIOStreams() pluginPaths := []string{pluginPath} o := &PluginListOptions{ diff --git a/internal/cli/cmd/plugin/search.go b/internal/cli/cmd/plugin/search.go index 9bb22617cc3..7212a59adfa 100644 --- a/internal/cli/cmd/plugin/search.go +++ b/internal/cli/cmd/plugin/search.go @@ -27,7 +27,7 @@ import ( "github.com/pkg/errors" "github.com/sahilm/fuzzy" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -45,10 +45,10 @@ type pluginSearchOptions struct { keyword string limit int - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewPluginSearchCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginSearchCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &pluginSearchOptions{ IOStreams: streams, } diff --git a/internal/cli/cmd/plugin/uninstall.go b/internal/cli/cmd/plugin/uninstall.go index 3efd472356b..964a45e3d70 100644 --- a/internal/cli/cmd/plugin/uninstall.go +++ b/internal/cli/cmd/plugin/uninstall.go @@ -25,7 +25,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -40,7 +40,7 @@ var ( `) ) -func NewPluginUninstallCmd(_ genericclioptions.IOStreams) *cobra.Command { +func NewPluginUninstallCmd(_ genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "uninstall", Short: "Uninstall kbcli or kubectl plugins", diff --git a/internal/cli/cmd/plugin/upgrade.go b/internal/cli/cmd/plugin/upgrade.go index da6084b7183..ceeae5f4e62 100644 --- a/internal/cli/cmd/plugin/upgrade.go +++ b/internal/cli/cmd/plugin/upgrade.go @@ -27,7 +27,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" k8sver "k8s.io/apimachinery/pkg/util/version" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/templates" @@ -48,10 +48,10 @@ type UpgradeOptions struct { all bool pluginNames []string - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewPluginUpgradeCmd(streams genericclioptions.IOStreams) *cobra.Command { +func NewPluginUpgradeCmd(streams genericiooptions.IOStreams) *cobra.Command { o := &UpgradeOptions{ IOStreams: streams, } diff --git a/internal/cli/cmd/report/report.go b/internal/cli/cmd/report/report.go index 48c20c18eae..213aeab6a58 100644 --- a/internal/cli/cmd/report/report.go +++ b/internal/cli/cmd/report/report.go @@ -32,6 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/printers" "k8s.io/klog/v2" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -101,7 +102,7 @@ var _ reportInterface = &reportKubeblocksOptions{} var _ reportInterface = &reportClusterOptions{} // NewReportCmd creates command for reports. -func NewReportCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func NewReportCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "report [kubeblocks | cluster]", Short: "report kubeblocks or cluster info.", @@ -119,7 +120,7 @@ type reportInterface interface { handleManifests(ctx context.Context) error } type reportOptions struct { - genericclioptions.IOStreams + genericiooptions.IOStreams // file name to output file string // namespace of resource @@ -161,7 +162,7 @@ type reportClusterOptions struct { cluster *appsv1alpha1.Cluster } -func newReportOptions(f genericclioptions.IOStreams) reportOptions { +func newReportOptions(f genericiooptions.IOStreams) reportOptions { return reportOptions{ IOStreams: f, JSONYamlPrintFlags: genericclioptions.NewJSONYamlPrintFlags(), @@ -256,7 +257,7 @@ func (o *reportOptions) parsePrinter() (printers.ResourcePrinterFunc, error) { return printer.PrintObj, nil } -func newKubeblocksReportCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newKubeblocksReportCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &reportKubeblocksOptions{reportOptions: newReportOptions(streams)} cmd := &cobra.Command{ Use: "kubeblocks [-f file] [--with-logs] [--mask]", @@ -289,7 +290,7 @@ func (o *reportKubeblocksOptions) complete(f cmdutil.Factory) error { return nil } -func (o *reportKubeblocksOptions) run(f cmdutil.Factory, streams genericclioptions.IOStreams) error { +func (o *reportKubeblocksOptions) run(f cmdutil.Factory, streams genericiooptions.IOStreams) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -394,7 +395,7 @@ func (o *reportKubeblocksOptions) handleLogs(ctx context.Context) error { return nil } -func newClusterReportCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { +func newClusterReportCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := &reportClusterOptions{reportOptions: newReportOptions(streams)} cmd := &cobra.Command{ @@ -445,7 +446,7 @@ func (o *reportClusterOptions) complete(f cmdutil.Factory) error { return nil } -func (o *reportClusterOptions) run(f cmdutil.Factory, streams genericclioptions.IOStreams) error { +func (o *reportClusterOptions) run(f cmdutil.Factory, streams genericiooptions.IOStreams) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() var err error diff --git a/internal/cli/cmd/report/report_test.go b/internal/cli/cmd/report/report_test.go index b21e87d5bcb..b327f3560b9 100644 --- a/internal/cli/cmd/report/report_test.go +++ b/internal/cli/cmd/report/report_test.go @@ -28,8 +28,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/client-go/kubernetes" - clientfake "k8s.io/client-go/rest/fake" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -37,9 +35,11 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/printers" "k8s.io/cli-runtime/pkg/resource" + "k8s.io/client-go/kubernetes" + clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" kbclischeme "github.com/apecloud/kubeblocks/internal/cli/scheme" @@ -52,7 +52,7 @@ import ( var _ = Describe("report", func() { var ( namespace = "test" - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) @@ -74,7 +74,7 @@ var _ = Describe("report", func() { tf = cmdtesting.NewTestFactory().WithNamespace(namespace) tf.Client = &clientfake.RESTClient{} tf.FakeDynamicClient = testing.FakeDynamicClient() - streams = genericclioptions.NewTestIOStreamsDiscard() + streams = genericiooptions.NewTestIOStreamsDiscard() }) AfterEach(func() { @@ -342,7 +342,7 @@ var _ = Describe("report", func() { tf.Client = tf.UnstructuredClient tf.FakeDynamicClient = testing.FakeDynamicClient(deploy, podEvent, &secrets.Items[0]) - streams = genericclioptions.NewTestIOStreamsDiscard() + streams = genericiooptions.NewTestIOStreamsDiscard() }) It("complete kb-report options", func() { @@ -426,7 +426,7 @@ var _ = Describe("report", func() { tf.Client = tf.UnstructuredClient tf.FakeDynamicClient = testing.FakeDynamicClient(deploy, sts, event) kbfakeclient = testing.FakeKBClientSet(cluster, clusterDef, clusterVersion) - streams = genericclioptions.NewTestIOStreamsDiscard() + streams = genericiooptions.NewTestIOStreamsDiscard() }) It("validate cluster-report options", func() { diff --git a/internal/cli/create/create.go b/internal/cli/create/create.go index 3642e074b22..91607bac8e2 100755 --- a/internal/cli/create/create.go +++ b/internal/cli/create/create.go @@ -36,6 +36,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/printers" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" @@ -101,7 +102,7 @@ type CreateOptions struct { // Quiet minimize unnecessary output Quiet bool - genericclioptions.IOStreams + genericiooptions.IOStreams } func (o *CreateOptions) Complete() error { @@ -210,11 +211,11 @@ func (o *CreateOptions) Run() error { return nil } } - printer, err := o.ToPrinter(nil, false) + p, err := o.ToPrinter(nil, false) if err != nil { return err } - return printer.PrintObj(resObj, o.Out) + return p.PrintObj(resObj, o.Out) } func (o *CreateOptions) CleanUp() error { diff --git a/internal/cli/create/create_test.go b/internal/cli/create/create_test.go index 81c0d0b6607..8c546b1f309 100755 --- a/internal/cli/create/create_test.go +++ b/internal/cli/create/create_test.go @@ -25,7 +25,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -42,12 +42,12 @@ var _ = Describe("Create", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams options CreateOptions ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} clusterOptions := map[string]interface{}{ diff --git a/internal/cli/delete/delete.go b/internal/cli/delete/delete.go index 7f9e634d010..801b347e319 100644 --- a/internal/cli/delete/delete.go +++ b/internal/cli/delete/delete.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -59,10 +59,10 @@ type DeleteOptions struct { PreDeleteHook DeleteHook PostDeleteHook DeleteHook - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewDeleteOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, gvr schema.GroupVersionResource) *DeleteOptions { +func NewDeleteOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, gvr schema.GroupVersionResource) *DeleteOptions { return &DeleteOptions{ Factory: f, IOStreams: streams, diff --git a/internal/cli/delete/delete_test.go b/internal/cli/delete/delete_test.go index 30001727e19..a36a3ee6064 100644 --- a/internal/cli/delete/delete_test.go +++ b/internal/cli/delete/delete_test.go @@ -29,7 +29,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -42,7 +42,7 @@ import ( var _ = Describe("Delete", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams in *bytes.Buffer tf *cmdtesting.TestFactory o *DeleteOptions @@ -54,7 +54,7 @@ var _ = Describe("Delete", func() { ) BeforeEach(func() { - streams, in, _, _ = genericclioptions.NewTestIOStreams() + streams, in, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) _ = appsv1alpha1.AddToScheme(scheme.Scheme) diff --git a/internal/cli/edit/custom_edit.go b/internal/cli/edit/custom_edit.go index 3c16f064d5a..7c8bf18296a 100644 --- a/internal/cli/edit/custom_edit.go +++ b/internal/cli/edit/custom_edit.go @@ -32,6 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/cmd/util/editor" @@ -48,10 +49,10 @@ type CustomEditOptions struct { Method string TestEnv bool - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewCustomEditOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, method string) *CustomEditOptions { +func NewCustomEditOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, method string) *CustomEditOptions { return &CustomEditOptions{ Factory: f, PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput("yaml"), @@ -185,7 +186,7 @@ func addHeader(w io.Writer) error { return err } -func confirmToContinue(stream genericclioptions.IOStreams) error { +func confirmToContinue(stream genericiooptions.IOStreams) error { printer.Warning(stream.Out, "Above resource will be created or changed, do you want to continue to create or change this resource?\n Only 'yes' will be accepted to confirm.\n\n") entered, _ := prompt.NewPrompt("Enter a value:", nil, stream.In).Run() if entered != "yes" { diff --git a/internal/cli/edit/custom_edit_test.go b/internal/cli/edit/custom_edit_test.go index e973aa15d11..ffe0d9df862 100644 --- a/internal/cli/edit/custom_edit_test.go +++ b/internal/cli/edit/custom_edit_test.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" clientfake "k8s.io/client-go/rest/fake" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" @@ -33,12 +33,12 @@ import ( var _ = Describe("Custom edit", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) tf.Client = &clientfake.RESTClient{} }) diff --git a/internal/cli/edit/edit.go b/internal/cli/edit/edit.go index e2be5ae2262..1f327ee5f20 100644 --- a/internal/cli/edit/edit.go +++ b/internal/cli/edit/edit.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/cmd/util/editor" @@ -39,7 +39,7 @@ type EditOptions struct { GVR schema.GroupVersionResource } -func NewEditOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, +func NewEditOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, gvr schema.GroupVersionResource) *EditOptions { return &EditOptions{ Factory: f, diff --git a/internal/cli/edit/edit_test.go b/internal/cli/edit/edit_test.go index 62b1593a76a..db9600c08be 100644 --- a/internal/cli/edit/edit_test.go +++ b/internal/cli/edit/edit_test.go @@ -28,7 +28,7 @@ import ( "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest/fake" @@ -39,7 +39,7 @@ import ( var _ = Describe("List", func() { var ( - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams tf *cmdtesting.TestFactory ) diff --git a/internal/cli/exec/exec.go b/internal/cli/exec/exec.go index 24d813d09f5..ea299dbe79d 100644 --- a/internal/cli/exec/exec.go +++ b/internal/cli/exec/exec.go @@ -26,7 +26,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" @@ -53,7 +53,7 @@ type ExecOptions struct { Command []string } -func NewExecOptions(f cmdutil.Factory, streams genericclioptions.IOStreams) *ExecOptions { +func NewExecOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *ExecOptions { return &ExecOptions{ Factory: f, StreamOptions: cmdexec.StreamOptions{ diff --git a/internal/cli/exec/exec_test.go b/internal/cli/exec/exec_test.go index 015556e53ab..fabae584dd4 100644 --- a/internal/cli/exec/exec_test.go +++ b/internal/cli/exec/exec_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" "k8s.io/client-go/rest/fake" @@ -52,7 +52,7 @@ var _ = Describe("Exec", func() { } tf.ClientConfigVal = &restclient.Config{APIPath: "/api", ContentConfig: restclient.ContentConfig{NegotiatedSerializer: scheme.Codecs, GroupVersion: &schema.GroupVersion{Version: "v1"}}} - testOptions := &testExecOptions{ExecOptions: NewExecOptions(tf, genericclioptions.NewTestIOStreamsDiscard())} + testOptions := &testExecOptions{ExecOptions: NewExecOptions(tf, genericiooptions.NewTestIOStreamsDiscard())} execOptions := testOptions.ExecOptions By("complete") diff --git a/internal/cli/list/list.go b/internal/cli/list/list.go index 4af82f4b644..61c1eef4856 100644 --- a/internal/cli/list/list.go +++ b/internal/cli/list/list.go @@ -36,6 +36,7 @@ import ( utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/printers" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" @@ -65,10 +66,10 @@ type ListOptions struct { // only return the result to caller. Print bool SortBy string - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewListOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, +func NewListOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, gvr schema.GroupVersionResource) *ListOptions { return &ListOptions{ Factory: f, @@ -85,7 +86,7 @@ func (o *ListOptions) AddFlags(cmd *cobra.Command, isClusterScope ...bool) { } cmd.Flags().StringVarP(&o.LabelSelector, "selector", "l", o.LabelSelector, "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints.") cmd.Flags().BoolVar(&o.ShowLabels, "show-labels", false, "When printing, show all labels as the last column (default hide labels column)") - //Todo: --sortBy supports custom field sorting, now `list` is to sort using the `.metadata.name` field in default + // Todo: --sortBy supports custom field sorting, now `list` is to sort using the `.metadata.name` field in default printer.AddOutputFlag(cmd, &o.Format) } diff --git a/internal/cli/list/list_test.go b/internal/cli/list/list_test.go index 9b54e73ac50..fac45b0d23d 100644 --- a/internal/cli/list/list_test.go +++ b/internal/cli/list/list_test.go @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest/fake" @@ -42,10 +42,10 @@ import ( var _ = Describe("List", func() { var cmd *cobra.Command - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams buf := new(bytes.Buffer) - buildTestCmd := func(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { + buildTestCmd := func(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { o := NewListOptions(f, streams, schema.GroupVersionResource{Group: "", Resource: "pods", Version: types.K8sCoreAPIVersion}) cmd := &cobra.Command{ Use: "ls-test", @@ -74,7 +74,7 @@ var _ = Describe("List", func() { BeforeEach(func() { pods, _, _ := cmdtesting.TestData() tf := mockClient(pods) - streams, _, buf, _ = genericclioptions.NewTestIOStreams() + streams, _, buf, _ = genericiooptions.NewTestIOStreams() cmd = buildTestCmd(tf, streams) cmd.SetOut(buf) }) @@ -82,7 +82,7 @@ var _ = Describe("List", func() { It("run", func() { pods, _, _ := cmdtesting.TestData() tf := mockClient(pods) - streams, _, buf, _ := genericclioptions.NewTestIOStreams() + streams, _, buf, _ := genericiooptions.NewTestIOStreams() cmd := buildTestCmd(tf, streams) cmd.Run(cmd, []string{}) Expect(len(buf.String()) > 0).Should(BeTrue()) @@ -216,7 +216,7 @@ metadata: It("No resources found", func() { tf := mockClient(&corev1.PodList{}) - streams, _, buf, errbuf := genericclioptions.NewTestIOStreams() + streams, _, buf, errbuf := genericiooptions.NewTestIOStreams() cmd = buildTestCmd(tf, streams) cmd.SetOut(buf) cmd.Run(cmd, []string{}) diff --git a/internal/cli/patch/patch.go b/internal/cli/patch/patch.go index ae3a90cd96e..c541cfe4556 100644 --- a/internal/cli/patch/patch.go +++ b/internal/cli/patch/patch.go @@ -37,6 +37,7 @@ import ( "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/printers" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" @@ -72,10 +73,10 @@ type Options struct { EditBeforeUpdate bool - genericclioptions.IOStreams + genericiooptions.IOStreams } -func NewOptions(f cmdutil.Factory, streams genericclioptions.IOStreams, gvr schema.GroupVersionResource) *Options { +func NewOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, gvr schema.GroupVersionResource) *Options { return &Options{ Factory: f, GVR: gvr, diff --git a/internal/cli/patch/patch_test.go b/internal/cli/patch/patch_test.go index 987f04546bd..0e0840d222f 100644 --- a/internal/cli/patch/patch_test.go +++ b/internal/cli/patch/patch_test.go @@ -22,19 +22,20 @@ package patch import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "github.com/apecloud/kubeblocks/internal/cli/types" ) var _ = Describe("Patch", func() { - var streams genericclioptions.IOStreams + var streams genericiooptions.IOStreams var tf *cmdtesting.TestFactory BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace("default") }) diff --git a/internal/cli/util/completion.go b/internal/cli/util/completion.go index 6e6e61d17eb..91d252c6a0f 100644 --- a/internal/cli/util/completion.go +++ b/internal/cli/util/completion.go @@ -28,7 +28,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/printers" "k8s.io/kubectl/pkg/cmd/get" cmdutil "k8s.io/kubectl/pkg/cmd/util" @@ -69,7 +69,7 @@ func CompGetResourceWithLabels(f cmdutil.Factory, cmd *cobra.Command, resourceNa // will get the output of `kubectl get pods --template=template -l app=nginx`, and split the output by space and return func CompGetFromTemplateWithLabels(template *string, f cmdutil.Factory, namespace string, cmd *cobra.Command, args []string, labels []string, toComplete string) []string { buf := new(bytes.Buffer) - streams := genericclioptions.IOStreams{In: os.Stdin, Out: buf, ErrOut: ioutil.Discard} + streams := genericiooptions.IOStreams{In: os.Stdin, Out: buf, ErrOut: ioutil.Discard} o := get.NewGetOptions("kubectl", streams) // Get the list of names of the specified resource diff --git a/internal/cli/util/completion_test.go b/internal/cli/util/completion_test.go index 80f604c3ee9..ecaa5327533 100644 --- a/internal/cli/util/completion_test.go +++ b/internal/cli/util/completion_test.go @@ -27,7 +27,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -46,12 +46,12 @@ var _ = Describe("completion", func() { var ( tf *cmdtesting.TestFactory - streams genericclioptions.IOStreams + streams genericiooptions.IOStreams pods = testing.FakePods(3, namespace, clusterName) ) BeforeEach(func() { - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() tf = cmdtesting.NewTestFactory().WithNamespace(testing.Namespace) }) diff --git a/internal/cli/util/flags/flags_test.go b/internal/cli/util/flags/flags_test.go index 83865046029..113f1c47564 100644 --- a/internal/cli/util/flags/flags_test.go +++ b/internal/cli/util/flags/flags_test.go @@ -20,13 +20,15 @@ along with this program. If not, see . package flags import ( - "github.com/apecloud/kubeblocks/internal/cli/testing" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/spf13/cobra" clientfake "k8s.io/client-go/rest/fake" "k8s.io/kube-openapi/pkg/validation/spec" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" + + "github.com/apecloud/kubeblocks/internal/cli/testing" ) const singleFlags = `{ diff --git a/internal/preflight/collect_test.go b/internal/preflight/collect_test.go index d277d47cd55..f7fd95ea651 100644 --- a/internal/preflight/collect_test.go +++ b/internal/preflight/collect_test.go @@ -31,7 +31,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" clientfake "k8s.io/client-go/rest/fake" @@ -56,7 +56,7 @@ var _ = Describe("collect_test", func() { ) BeforeEach(func() { - _, _, _, _ = genericclioptions.NewTestIOStreams() + _, _, _, _ = genericiooptions.NewTestIOStreams() tf = testing.NewTestFactory(namespace) codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) httpResp := func(obj runtime.Object) *http.Response { diff --git a/internal/preflight/text_results_test.go b/internal/preflight/text_results_test.go index d5921e588d3..1fe8b3d09d4 100644 --- a/internal/preflight/text_results_test.go +++ b/internal/preflight/text_results_test.go @@ -22,7 +22,8 @@ package preflight import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/cli-runtime/pkg/genericclioptions" + + "k8s.io/cli-runtime/pkg/genericiooptions" analyzerunner "github.com/replicatedhq/troubleshoot/pkg/analyze" ) @@ -34,7 +35,7 @@ var _ = Describe("text_results_test", func() { yamlFormat = "yaml" kbcliFormat = "kbcli" unknownFormat = "unknown" - streams, _, _, _ = genericclioptions.NewTestIOStreams() + streams, _, _, _ = genericiooptions.NewTestIOStreams() out = streams.Out ) It("ShowStdoutResults Test", func() { diff --git a/lorry/middleware/probe/router.go b/lorry/middleware/probe/router.go index 3870e305336..fd7f4f9b845 100644 --- a/lorry/middleware/probe/router.go +++ b/lorry/middleware/probe/router.go @@ -26,11 +26,12 @@ import ( "io" "net/http" - viper "github.com/apecloud/kubeblocks/internal/viperx" "github.com/go-errors/errors" - "github.com/apecloud/kubeblocks/internal/constant" . "github.com/apecloud/kubeblocks/lorry/binding" + + "github.com/apecloud/kubeblocks/internal/constant" + viper "github.com/apecloud/kubeblocks/internal/viperx" "github.com/apecloud/kubeblocks/lorry/binding/custom" "github.com/apecloud/kubeblocks/lorry/binding/etcd" "github.com/apecloud/kubeblocks/lorry/binding/mongodb"