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 c2bd71e3 [operator] Supplemental client-side factory logic and some
fragmented logic
c2bd71e3 is described below
commit c2bd71e33fb3748099dea5f09204230385c86269
Author: mfordjody <[email protected]>
AuthorDate: Mon Dec 9 09:17:46 2024 +0800
[operator] Supplemental client-side factory logic and some fragmented logic
---
dubboctl/pkg/cli/context.go | 4 ++--
pkg/kube/client.go | 19 +++++++++++++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/dubboctl/pkg/cli/context.go b/dubboctl/pkg/cli/context.go
index 7daf2b69..ca41448d 100644
--- a/dubboctl/pkg/cli/context.go
+++ b/dubboctl/pkg/cli/context.go
@@ -31,7 +31,7 @@ func NewCLIContext(rootFlags *RootFlags) Context {
}
func (i *instance) CLIClient() (kube.CLIClient, error) {
- return nil, nil
+ return i.CLIClientWithRevision("")
}
func (i *instance) CLIClientWithRevision(rev string) (kube.CLIClient, error) {
@@ -56,5 +56,5 @@ func newKubeClientWithRevision(kubeconfig, context, revision
string, impersonati
if err != nil {
return nil, err
}
- return nil, nil
+ return kube.NewCLIClient(kube.NewClientConfigForRestConfig(drc),
kube.WithRevision(revision))
}
diff --git a/pkg/kube/client.go b/pkg/kube/client.go
index 265e55cb..20dcdf26 100644
--- a/pkg/kube/client.go
+++ b/pkg/kube/client.go
@@ -13,7 +13,9 @@ import (
)
type client struct {
- dynamic dynamic.Interface
+ dynamic dynamic.Interface
+ revision string
+ factory *clientFactory
}
type Client interface {
@@ -27,10 +29,15 @@ type CLIClient interface {
type ClientOption func(cliClient CLIClient) CLIClient
func NewCLIClient(clientCfg clientcmd.ClientConfig, opts ...ClientOption)
(CLIClient, error) {
-
return nil, nil
}
+func newInternalClient(factory *clientFactory, opts ...ClientOption)
(CLIClient, error) {
+ var c client
+ var err error
+ c.factory = factory
+}
+
var (
_ Client = &client{}
_ CLIClient = &client{}
@@ -45,6 +52,14 @@ func (c *client) DynamicClientFor(gvk
schema.GroupVersionKind, obj *unstructured
return dr, nil
}
+func WithRevision(revision string) ClientOption {
+ return func(cliClient CLIClient) CLIClient {
+ client := cliClient.(*client)
+ client.revision = revision
+ return client
+ }
+}
+
var (
DubboScheme = dubboScheme()
DubboCodec = serializer.NewCodecFactory(DubboScheme)