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 de158979 [operator] Add console log and fix install
de158979 is described below
commit de1589798a0dd23faab3d023922c6fdfec9bdb0b
Author: mfordjody <[email protected]>
AuthorDate: Thu Dec 5 11:39:23 2024 +0800
[operator] Add console log and fix install
---
operator/cmd/cluster/install.go | 14 +++++++-------
operator/pkg/util/clog/clog.go | 3 ++-
operator/pkg/util/clog/log/scope.go | 26 ++++++++++++++++++++++++++
pkg/kube/client.go | 4 ----
4 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/operator/cmd/cluster/install.go b/operator/cmd/cluster/install.go
index b5ce32ed..deb5426f 100644
--- a/operator/cmd/cluster/install.go
+++ b/operator/cmd/cluster/install.go
@@ -28,25 +28,25 @@ func (i *InstallArgs) String() string {
}
func InstallCmd(ctx cli.Context) *cobra.Command {
- return nil
+ return InstallCmdWithArgs(ctx, &RootArgs{}, &InstallArgs{})
}
func InstallCmdWithArgs(ctx cli.Context, rootArgs *RootArgs, iArgs
*InstallArgs) *cobra.Command {
ic := &cobra.Command{
Use: "install",
- Short: "Applies an Dubbo manifest, installing or reconfiguring
Dubbo on a cluster.",
- Long: "The install command generates an Dubbo install manifest
and applies it to a cluster.",
- Example: `# Apply a default dubboctl installation
+ Short: "Applies an Dubbo manifest, installing or reconfiguring
Dubbo on a cluster",
+ Long: "The install command generates an Dubbo install manifest
and applies it to a cluster",
+ Example: `# Apply a default dubboctl installation.
dubboctl install
- # Apply a default profile
+ # Apply a default profile.
dubboctl install --profile=default`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
- _, err := ctx.CLIClient()
+ kubeClient, err := ctx.CLIClient()
if err != nil {
return err
}
- return install(ctx, rootArgs, iArgs)
+ return install(kubeClient, rootArgs, iArgs)
},
}
return ic
diff --git a/operator/pkg/util/clog/clog.go b/operator/pkg/util/clog/clog.go
index fd1cbc90..8f6e727f 100644
--- a/operator/pkg/util/clog/clog.go
+++ b/operator/pkg/util/clog/clog.go
@@ -5,6 +5,7 @@ import "io"
type ConsoleLogger struct {
stdOut io.Writer
stdErr io.Writer
+ scope *log.Scope
}
type Logger interface {
@@ -21,5 +22,5 @@ func NewDefaultLogger() *ConsoleLogger {
}
func (l *ConsoleLogger) LogAndPrint(v ...any) {
-
+ return
}
diff --git a/operator/pkg/util/clog/log/scope.go
b/operator/pkg/util/clog/log/scope.go
new file mode 100644
index 00000000..f332139f
--- /dev/null
+++ b/operator/pkg/util/clog/log/scope.go
@@ -0,0 +1,26 @@
+package log
+
+import (
+ "fmt"
+ "strings"
+ "sync"
+)
+
+type Scope struct {
+ name string
+}
+
+var (
+ lock sync.RWMutex
+)
+
+func RegisterScope(name string, desc string) *Scope {
+ return registerScope(name, desc)
+}
+
+func registerScope(name string, desc string) *Scope {
+ if strings.ContainsAny(name, ":,.") {
+ panic(fmt.Sprintf("scope name %s is invalid, it cannot contain
colons, commas, or periods", name))
+ }
+ return nil
+}
diff --git a/pkg/kube/client.go b/pkg/kube/client.go
index 22ae4a54..51be64e8 100644
--- a/pkg/kube/client.go
+++ b/pkg/kube/client.go
@@ -55,7 +55,3 @@ func dubboScheme() *runtime.Scheme {
utilruntime.Must(apiextensionsv1.AddToScheme(scheme))
return scheme
}
-
-func SlowConvertToRuntimeObject() {
- return
-}