diff options
| author | KubeEdge Bot <48982446+kubeedge-bot@users.noreply.github.com> | 2024-08-12 10:54:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-12 10:54:23 +0800 |
| commit | e4dbcb31b888a66cb52116df6ceeec0e86892aed (patch) | |
| tree | 3ead8e7a737d817340008beb175709f73ef1bafc | |
| parent | Merge pull request #5763 from 1Shubham7/ut (diff) | |
| parent | Cleanup the kube client tool (diff) | |
| download | kubeedge-e4dbcb31b888a66cb52116df6ceeec0e86892aed.tar.gz | |
Merge pull request #5790 from WillardHu/cleanup-kubeclient
Cleanup the kube client tool
| -rw-r--r-- | cloud/pkg/common/client/client.go | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/cloud/pkg/common/client/client.go b/cloud/pkg/common/client/client.go index 4d1d8c305..751d2b461 100644 --- a/cloud/pkg/common/client/client.go +++ b/cloud/pkg/common/client/client.go @@ -38,9 +38,6 @@ var ( kubeClient kubernetes.Interface crdClient crdClientset.Interface dynamicClient dynamic.Interface - // authKubeConfig only contains master address and CA cert when init, it is used for - // generating a temporary kubeclient and validating user token once receive an application message. - authKubeConfig *rest.Config KubeConfig *rest.Config CrdConfig *rest.Config @@ -50,8 +47,7 @@ func InitKubeEdgeClient(config *cloudcoreConfig.KubeAPIConfig, enableImpersonati initOnce.Do(func() { kubeConfig, err := clientcmd.BuildConfigFromFlags(config.Master, config.KubeConfig) if err != nil { - klog.Errorf("Failed to build config, err: %v", err) - os.Exit(1) + panic(fmt.Errorf("failed to build kube config, err: %v", err)) } kubeConfig.QPS = float32(config.QPS) kubeConfig.Burst = int(config.Burst) @@ -67,15 +63,6 @@ func InitKubeEdgeClient(config *cloudcoreConfig.KubeAPIConfig, enableImpersonati crdKubeConfig.ContentType = runtime.ContentTypeJSON CrdConfig = crdKubeConfig crdClient = newForCrdConfigOrDie(crdKubeConfig, enableImpersonation) - - authKubeConfig, err = clientcmd.BuildConfigFromFlags(kubeConfig.Host, "") - if err != nil { - klog.Errorf("Failed to build config, err: %v", err) - os.Exit(1) - } - authKubeConfig.CAData = kubeConfig.CAData - authKubeConfig.CAFile = kubeConfig.CAFile - authKubeConfig.ContentType = runtime.ContentTypeJSON }) } @@ -91,10 +78,6 @@ func GetDynamicClient() dynamic.Interface { return dynamicClient } -func GetAuthConfig() *rest.Config { - return authKubeConfig -} - func GetK8sCA() []byte { ca, err := os.ReadFile(KubeConfig.CAFile) if err != nil { |
