This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new ce106ec9 [operator] Additional k8s client configuration
ce106ec9 is described below

commit ce106ec9f5827797511947d8f3b6277db2c35d11
Author: mfordjody <[email protected]>
AuthorDate: Mon Dec 9 09:00:47 2024 +0800

    [operator] Additional k8s client configuration
---
 pkg/kube/client_config.go | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/pkg/kube/client_config.go b/pkg/kube/client_config.go
index 42cbdd63..679fe02f 100644
--- a/pkg/kube/client_config.go
+++ b/pkg/kube/client_config.go
@@ -3,6 +3,7 @@ package kube
 import (
        "k8s.io/client-go/rest"
        "k8s.io/client-go/tools/clientcmd"
+       "k8s.io/client-go/tools/clientcmd/api"
 )
 
 type clientConfig struct {
@@ -10,19 +11,33 @@ type clientConfig struct {
 }
 
 func (c clientConfig) RawConfig() (api.Config, error) {
-       panic("implement me")
+       cfg := api.Config{
+               Kind:           "Config",
+               APIVersion:     "v1",
+               Preferences:    api.Preferences{},
+               Clusters:       map[string]*api.Cluster{},
+               AuthInfos:      map[string]*api.AuthInfo{},
+               Contexts:       map[string]*api.Context{},
+               CurrentContext: "",
+       }
+       return cfg, nil
 }
 
 func (c clientConfig) ClientConfig() (*rest.Config, error) {
-       panic("implement me")
+       return c.copyRestConfig(), nil
+}
+
+func (c *clientConfig) copyRestConfig() *rest.Config {
+       out := c.restConfig
+       return &out
 }
 
 func (c clientConfig) Namespace() (string, bool, error) {
-       panic("implement me")
+       return "default", false, nil
 }
 
 func (c clientConfig) ConfigAccess() clientcmd.ConfigAccess {
-       panic("implement me")
+       return nil
 }
 
 func NewClientConfigForRestConfig(restConfig *rest.Config) 
clientcmd.ClientConfig {

Reply via email to