From f6643bcaafefbc60a675095a5e4cf58ff86d41f1 Mon Sep 17 00:00:00 2001 From: mfordjody <11638005@qq.com> Date: Sun, 8 Dec 2024 11:49:34 +0800 Subject: [PATCH] [operator] fix kube clientcmd util --- dubboctl/pkg/cli/context.go | 8 ++++++++ pkg/kube/client.go | 3 ++- pkg/{util => }/kube/util.go | 1 - pkg/util/kube/client.go | 15 --------------- 4 files changed, 10 insertions(+), 17 deletions(-) rename pkg/{util => }/kube/util.go (99%) delete mode 100644 pkg/util/kube/client.go diff --git a/dubboctl/pkg/cli/context.go b/dubboctl/pkg/cli/context.go index f3a531f16..1d90182d6 100644 --- a/dubboctl/pkg/cli/context.go +++ b/dubboctl/pkg/cli/context.go @@ -3,6 +3,7 @@ package cli import ( "github.com/apache/dubbo-kubernetes/pkg/kube" "github.com/apache/dubbo-kubernetes/pkg/pointer" + "k8s.io/client-go/rest" ) type instance struct { @@ -41,5 +42,12 @@ func (i *instance) CLIClientWithRevision(rev string) (kube.CLIClient, error) { } func newKubeClientWithRevision(kubeconfig, context, revision string) (kube.CLIClient, error) { + drc, err := kube.DefaultRestConfig(kubeconfig, context, func(config *rest.Config) { + config.QPS = 50 + config.Burst = 100 + }) + if err != nil { + return nil, err + } return nil, nil } diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 51be64e80..265e55cbd 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -26,7 +26,8 @@ type CLIClient interface { type ClientOption func(cliClient CLIClient) CLIClient -func NewClientClient(clientCfg clientcmd.ClientConfig) (CLIClient, error) { +func NewCLIClient(clientCfg clientcmd.ClientConfig, opts ...ClientOption) (CLIClient, error) { + return nil, nil } diff --git a/pkg/util/kube/util.go b/pkg/kube/util.go similarity index 99% rename from pkg/util/kube/util.go rename to pkg/kube/util.go index 1b244f9fe..d2e57b943 100644 --- a/pkg/util/kube/util.go +++ b/pkg/kube/util.go @@ -5,7 +5,6 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - "os" ) diff --git a/pkg/util/kube/client.go b/pkg/util/kube/client.go deleted file mode 100644 index 87ce24961..000000000 --- a/pkg/util/kube/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package kube - -import ( - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - kubescheme "k8s.io/client-go/kubernetes/scheme" -) - -func dubboScheme() *runtime.Scheme { - scheme := runtime.NewScheme() - utilruntime.Must(kubescheme.AddToScheme(scheme)) - utilruntime.Must(apiextensionsv1.AddToScheme(scheme)) - -}