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 c5ad4dea [dubboctl] Fixed some bugs (#688)
c5ad4dea is described below

commit c5ad4deae0cb9e2a0756e08bcdf79849cc14bbc8
Author: Jian Zhong <[email protected]>
AuthorDate: Sat Apr 19 09:14:31 2025 +0800

    [dubboctl] Fixed some bugs (#688)
---
 dubboctl/cmd/create.go                           | 41 +++++------
 dubboctl/cmd/image.go                            | 93 ++++++++++++------------
 dubboctl/cmd/root.go                             | 14 ++--
 dubboctl/pkg/cli/context.go                      | 24 +++---
 dubboctl/pkg/cli/options.go                      | 30 ++------
 dubboctl/pkg/hub/builder/dockerfile/build.go     |  1 -
 dubboctl/pkg/hub/ssh/{agent.go => connection.go} |  0
 dubboctl/pkg/sdk/client.go                       |  4 +-
 dubboctl/pkg/sdk/dubbo/config.go                 | 24 +++---
 dubboctl/pkg/sdk/dubbo/dockerfile.go             | 14 ++--
 dubboctl/pkg/validate/validate.go                |  2 +-
 manifests/addons/values-prometheus.yaml          |  8 --
 operator/cmd/cluster/manifest.go                 |  6 +-
 operator/cmd/cluster/upgrade.go                  |  5 +-
 operator/pkg/install/waiter.go                   |  8 +-
 15 files changed, 124 insertions(+), 150 deletions(-)

diff --git a/dubboctl/cmd/create.go b/dubboctl/cmd/create.go
index 4eed2af7..6b28d64f 100644
--- a/dubboctl/cmd/create.go
+++ b/dubboctl/cmd/create.go
@@ -103,16 +103,13 @@ func sdkGenerateCmd(cmd *cobra.Command, clientFactory 
ClientFactory) *cobra.Comm
 
 type createConfig struct {
        // Path Absolute to function source
-       Path string
-       // Runtime
-       Runtime string
-       // Template
+       Path     string
+       Runtime  string
        Template string
        // Repo Uri (overrides builtin and installed)
        Repo string
        // DirName Defines a custom creation directory name。
-       DirName string
-       // Initialized
+       DirName     string
        Initialized bool
 }
 
@@ -121,54 +118,54 @@ type createConfig struct {
 // The client constructor function is used to create a transient client for
 // accessing things like the current valid templates list, and uses the
 // current value of the config at time of prompting.
-func newCreateConfig(_ *cobra.Command, _ []string, _ ClientFactory) (dcfg 
createConfig, err error) {
+func newCreateConfig(_ *cobra.Command, _ []string, _ ClientFactory) (cc 
createConfig, err error) {
        var absolutePath string
        absolutePath = cwd()
 
-       dcfg = createConfig{
+       cc = createConfig{
                DirName:     viper.GetString("dirname"),
                Path:        absolutePath + "/" + viper.GetString("dirname"),
                Runtime:     viper.GetString("language"),
                Template:    viper.GetString("template"),
                Initialized: viper.GetBool("initialized"),
        }
-       fmt.Printf("Name:     %v\n", dcfg.DirName)
-       fmt.Printf("Path:     %v\n", dcfg.Path)
-       fmt.Printf("Language:     %v\n", dcfg.Runtime)
-       fmt.Printf("Template:     %v\n", dcfg.Template)
+       fmt.Printf("Name:     %v\n", cc.DirName)
+       fmt.Printf("Path:     %v\n", cc.Path)
+       fmt.Printf("Language:     %v\n", cc.Runtime)
+       fmt.Printf("Template:     %v\n", cc.Template)
        return
 }
 
 func runCreate(cmd *cobra.Command, args []string, clientFactory ClientFactory) 
error {
        // Create a config based on args.  Also uses the newClient to create a
        // temporary client for completing options such as available runtimes.
-       dcfg, err := newCreateConfig(cmd, args, clientFactory)
+       createCfg, err := newCreateConfig(cmd, args, clientFactory)
        if err != nil {
                return err
        }
        // From environment variables, flags, arguments, and user prompts if 
--confirm
        // (in increasing levels of precedence)
-       dclient, cancel := clientFactory()
+       client, cancel := clientFactory()
        defer cancel()
 
        // a deeper validation than that which is performed when
        // instantiating the client with the raw config above.
-       if err = dcfg.validate(dclient); err != nil {
+       if err = createCfg.validate(client); err != nil {
                return err
        }
 
        // Initialization creation
-       _, err = dclient.Initialize(&dubbo.DubboConfig{
-               Root:     dcfg.Path,
-               Name:     dcfg.DirName,
-               Runtime:  dcfg.Runtime,
-               Template: dcfg.Template,
-       }, dcfg.Initialized, cmd)
+       _, err = client.Initialize(&dubbo.DubboConfig{
+               Root:     createCfg.Path,
+               Name:     createCfg.DirName,
+               Runtime:  createCfg.Runtime,
+               Template: createCfg.Template,
+       }, createCfg.Initialized, cmd)
        if err != nil {
                return err
        }
 
-       fmt.Printf("Custom dubbo %v sdk was successfully created.\n", 
dcfg.Runtime)
+       fmt.Printf("dubbo %v sdk was successfully created.\n", 
createCfg.Runtime)
        return nil
 }
 
diff --git a/dubboctl/cmd/image.go b/dubboctl/cmd/image.go
index 4b5b2320..60de7106 100644
--- a/dubboctl/cmd/image.go
+++ b/dubboctl/cmd/image.go
@@ -118,8 +118,8 @@ func (hc hubConfig) imageClientOptions() ([]sdk.Option, 
error) {
        return do, nil
 }
 
-func (dc deployConfig) deployClientOptions() ([]sdk.Option, error) {
-       i, err := dc.imageClientOptions()
+func (d deployConfig) deployClientOptions() ([]sdk.Option, error) {
+       i, err := d.imageClientOptions()
        if err != nil {
                return i, err
        }
@@ -140,6 +140,10 @@ func imageHubCmd(cmd *cobra.Command, clientFactory 
ClientFactory) *cobra.Command
   dubboctl image hub -b
 `,
                Args: func(cmd *cobra.Command, args []string) error {
+                       if !iArgs.dockerfile && !iArgs.builder {
+                               return fmt.Errorf("at least one of the -b or -f 
flags must be set")
+                       }
+
                        if cmd.Flags().Changed("file") {
                                if len(args) != 1 {
                                        return fmt.Errorf("you must provide 
exactly one argument when using the -f flag: the path to the Dockerfile")
@@ -183,24 +187,24 @@ func runHub(cmd *cobra.Command, args []string, 
clientFactory ClientFactory) erro
        if err := util.GetCreatePath(); err != nil {
                return err
        }
-       hcfg := newHubConfig(cmd)
-       fp, err := dubbo.NewDubboConfig(hcfg.Path)
+       hubCfg := newHubConfig(cmd)
+       filePath, err := dubbo.NewDubboConfig(hubCfg.Path)
        if err != nil {
                return err
        }
 
-       hcfg, err = hcfg.hubPrompt(fp)
+       hubCfg, err = hubCfg.hubPrompt(filePath)
        if err != nil {
                return err
        }
 
-       if !fp.Initialized() {
-               return util.NewErrNotInitialized(fp.Root)
+       if !filePath.Initialized() {
+               return util.NewErrNotInitialized(filePath.Root)
        }
 
-       hcfg.checkHubConfig(fp)
+       hubCfg.checkHubConfig(filePath)
 
-       clientOptions, err := hcfg.imageClientOptions()
+       clientOptions, err := hubCfg.imageClientOptions()
        if err != nil {
                return err
        }
@@ -208,18 +212,17 @@ func runHub(cmd *cobra.Command, args []string, 
clientFactory ClientFactory) erro
        client, done := clientFactory(clientOptions...)
        defer done()
 
-       if fp.Built() {
-               return nil
-       }
-       if fp, err = client.Build(cmd.Context(), fp); err != nil {
+       filePath.Built()
+
+       if filePath, err = client.Build(cmd.Context(), filePath); err != nil {
                return err
        }
 
-       if fp, err = client.Push(cmd.Context(), fp); err != nil {
+       if filePath, err = client.Push(cmd.Context(), filePath); err != nil {
                return err
        }
 
-       err = fp.WriteFile()
+       err = filePath.WriteFile()
        if err != nil {
                return err
        }
@@ -248,16 +251,16 @@ func imageDeployCmd(cmd *cobra.Command, clientFactory 
ClientFactory) *cobra.Comm
        return hc
 }
 
-func (dc deployConfig) checkDeployConfig(dc2 *dubbo.DubboConfig) {
-       dc.checkHubConfig(dc2)
-       if dc.Output != "" {
-               dc2.Deploy.Output = dc.Output
+func (d deployConfig) checkDeployConfig(dc *dubbo.DubboConfig) {
+       d.checkHubConfig(dc)
+       if d.Output != "" {
+               dc.Deploy.Output = d.Output
        }
-       if dc.Namespace != "" {
-               dc2.Deploy.Namespace = dc.Namespace
+       if d.Namespace != "" {
+               dc.Deploy.Namespace = d.Namespace
        }
-       if dc.Port != 0 {
-               dc2.Deploy.Port = dc.Port
+       if d.Port != 0 {
+               dc.Deploy.Port = d.Port
        }
 }
 
@@ -265,43 +268,43 @@ func runDeploy(cmd *cobra.Command, args []string, 
clientFactory ClientFactory) e
        if err := util.GetCreatePath(); err != nil {
                return err
        }
-       dcfg := newDeployConfig(cmd)
+       deployCfg := newDeployConfig(cmd)
 
-       fp, err := dubbo.NewDubboConfig(dcfg.Path)
+       filePath, err := dubbo.NewDubboConfig(deployCfg.Path)
        if err != nil {
                return err
        }
 
-       dcfg, err = dcfg.deployPrompt(fp)
+       deployCfg, err = deployCfg.deployPrompt(filePath)
        if err != nil {
                return err
        }
 
-       dcfg.checkDeployConfig(fp)
+       deployCfg.checkDeployConfig(filePath)
 
-       clientOptions, err := dcfg.deployClientOptions()
+       clientOptions, err := deployCfg.deployClientOptions()
        if err != nil {
                return err
        }
 
        client, done := clientFactory(clientOptions...)
        defer done()
-       if fp, err = client.Deploy(cmd.Context(), fp); err != nil {
+       if filePath, err = client.Deploy(cmd.Context(), filePath); err != nil {
                return err
        }
 
-       if !dcfg.Destroy {
-               if err := apply(cmd, fp); err != nil {
+       if !deployCfg.Destroy {
+               if err := apply(cmd, filePath); err != nil {
                        return err
                }
        }
-       if dcfg.Destroy {
-               if err := remove(cmd, fp); err != nil {
+       if deployCfg.Destroy {
+               if err := remove(cmd, filePath); err != nil {
                        return err
                }
        }
 
-       err = fp.WriteFile()
+       err = filePath.WriteFile()
        if err != nil {
                return err
        }
@@ -353,10 +356,10 @@ func (hc *hubConfig) hubPrompt(dc *dubbo.DubboConfig) 
(*hubConfig, error) {
        return hc, err
 }
 
-func (dc *deployConfig) deployPrompt(dc2 *dubbo.DubboConfig) (*deployConfig, 
error) {
+func (d *deployConfig) deployPrompt(dc2 *dubbo.DubboConfig) (*deployConfig, 
error) {
        var err error
        if !util.InteractiveTerminal() {
-               return dc, nil
+               return d, nil
        }
        if dc2.Deploy.Namespace == "" {
                qs := []*survey.Question{
@@ -368,19 +371,19 @@ func (dc *deployConfig) deployPrompt(dc2 
*dubbo.DubboConfig) (*deployConfig, err
                                },
                        },
                }
-               if err = survey.Ask(qs, dc); err != nil {
-                       return dc, err
+               if err = survey.Ask(qs, d); err != nil {
+                       return d, err
                }
        }
 
-       buildconfig, err := dc.hubConfig.hubPrompt(dc2)
+       buildconfig, err := d.hubConfig.hubPrompt(dc2)
        if err != nil {
-               return dc, err
+               return d, err
        }
 
-       dc.hubConfig = buildconfig
+       d.hubConfig = buildconfig
 
-       if dc2.Deploy.Port == 0 && dc.Port == 0 {
+       if dc2.Deploy.Port == 0 && d.Port == 0 {
                qs := []*survey.Question{
                        {
                                Name:     "port",
@@ -390,10 +393,10 @@ func (dc *deployConfig) deployPrompt(dc2 
*dubbo.DubboConfig) (*deployConfig, err
                                },
                        },
                }
-               if err = survey.Ask(qs, dc); err != nil {
-                       return dc, err
+               if err = survey.Ask(qs, d); err != nil {
+                       return d, err
                }
        }
 
-       return dc, err
+       return d, err
 }
diff --git a/dubboctl/cmd/root.go b/dubboctl/cmd/root.go
index 94b80cb1..b3d00cf8 100644
--- a/dubboctl/cmd/root.go
+++ b/dubboctl/cmd/root.go
@@ -108,7 +108,7 @@ func GetRootCmd(args []string) *cobra.Command {
 
        installCmd := cluster.InstallCmd(ctx)
        rootCmd.AddCommand(installCmd)
-       hideFlags(installCmd, cli.NamespaceFlag, cli.DubboNamespaceFlag, 
ChartFlag)
+       hideFlags(installCmd, ChartFlag)
 
        uninstallCmd := cluster.UninstallCmd(ctx)
        rootCmd.AddCommand(uninstallCmd)
@@ -118,27 +118,27 @@ func GetRootCmd(args []string) *cobra.Command {
 
        manifestCmd := cluster.ManifestCmd(ctx)
        rootCmd.AddCommand(manifestCmd)
-       hideFlags(manifestCmd, cli.NamespaceFlag, cli.DubboNamespaceFlag, 
ChartFlag)
+       hideFlags(manifestCmd, ChartFlag)
 
        validateCmd := validate.NewValidateCommand(ctx)
        rootCmd.AddCommand(validateCmd)
-       hideFlags(validateCmd, cli.NamespaceFlag, cli.DubboNamespaceFlag, 
ChartFlag)
+       hideFlags(validateCmd, ChartFlag)
 
        versionCmd := version.NewVersionCommand(ctx)
        rootCmd.AddCommand(versionCmd)
-       hideFlags(versionCmd, cli.NamespaceFlag, cli.DubboNamespaceFlag, 
ChartFlag)
+       hideFlags(versionCmd, ChartFlag)
 
        createCmd := CreateCmd(ctx, rootCmd, factory)
        rootCmd.AddCommand(createCmd)
-       hideFlags(createCmd, cli.NamespaceFlag, cli.DubboNamespaceFlag, 
ChartFlag)
+       hideFlags(createCmd, ChartFlag)
 
        repoCmd := RepoCmd(ctx, rootCmd, factory)
        rootCmd.AddCommand(repoCmd)
-       hideFlags(repoCmd, cli.NamespaceFlag, cli.DubboNamespaceFlag, ChartFlag)
+       hideFlags(repoCmd, ChartFlag)
 
        imageCmd := ImageCmd(ctx, rootCmd, factory)
        rootCmd.AddCommand(imageCmd)
-       hideFlags(imageCmd, cli.NamespaceFlag, cli.DubboNamespaceFlag, 
ChartFlag)
+       hideFlags(imageCmd, ChartFlag)
 
        return rootCmd
 
diff --git a/dubboctl/pkg/cli/context.go b/dubboctl/pkg/cli/context.go
index 49ef0c33..06a11ce5 100644
--- a/dubboctl/pkg/cli/context.go
+++ b/dubboctl/pkg/cli/context.go
@@ -24,23 +24,21 @@ import (
 )
 
 type instance struct {
-       clients map[string]kube.CLIClient
+       cliClient map[string]kube.CLIClient
        RootFlags
 }
 
 type Context interface {
        CLIClient() (kube.CLIClient, error)
        CLIClientWithRevision(rev string) (kube.CLIClient, error)
-       DubboNamespace() string
+       Namespace() string
 }
 
 func NewCLIContext(rootFlags *RootFlags) Context {
        if rootFlags == nil {
                rootFlags = &RootFlags{
-                       kubeconfig:     pointer.Of[string](""),
-                       Context:        pointer.Of[string](""),
-                       namespace:      pointer.Of[string](""),
-                       dubboNamespace: pointer.Of[string](""),
+                       kubeconfig: pointer.Of[string](""),
+                       Context:    pointer.Of[string](""),
                }
        }
        return &instance{
@@ -53,20 +51,24 @@ func (i *instance) CLIClient() (kube.CLIClient, error) {
 }
 
 func (i *instance) CLIClientWithRevision(rev string) (kube.CLIClient, error) {
-       if i.clients == nil {
-               i.clients = make(map[string]kube.CLIClient)
+       if i.cliClient == nil {
+               i.cliClient = make(map[string]kube.CLIClient)
        }
 
-       if i.clients[rev] == nil {
+       if i.cliClient[rev] == nil {
                impersonationConfig := rest.ImpersonationConfig{}
                client, err := newKubeClientWithRevision(*i.kubeconfig, 
*i.Context, rev, impersonationConfig)
                if err != nil {
                        return nil, err
                }
-               i.clients[rev] = client
+               i.cliClient[rev] = client
        }
 
-       return i.clients[rev], nil
+       return i.cliClient[rev], nil
+}
+
+func (i *instance) Namespace() string {
+       return "dubbo-system"
 }
 
 func newKubeClientWithRevision(kubeconfig, context, revision string, 
impersonationConfig rest.ImpersonationConfig) (kube.CLIClient, error) {
diff --git a/dubboctl/pkg/cli/options.go b/dubboctl/pkg/cli/options.go
index 0945f84e..c4a94876 100644
--- a/dubboctl/pkg/cli/options.go
+++ b/dubboctl/pkg/cli/options.go
@@ -19,43 +19,25 @@ package cli
 
 import (
        "github.com/apache/dubbo-kubernetes/operator/pkg/util/pointer"
-       "github.com/ory/viper"
        "github.com/spf13/pflag"
-       v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
 const (
-       KubeConfigFlag     = "kubeconfig"
-       ContextFlag        = "context"
-       NamespaceFlag      = "namespace"
-       DubboNamespaceFlag = "dubbo-namespace"
+       KubeConfigFlag = "kubeconfig"
+       ContextFlag    = "context"
 )
 
 type RootFlags struct {
-       kubeconfig     *string
-       Context        *string
-       namespace      *string
-       dubboNamespace *string
+       kubeconfig *string
+       Context    *string
 }
 
 func AddRootFlags(flags *pflag.FlagSet) *RootFlags {
        rootFlags := &RootFlags{
-               kubeconfig:     pointer.Of[string](""),
-               Context:        pointer.Of[string](""),
-               namespace:      pointer.Of[string](""),
-               dubboNamespace: pointer.Of[string](""),
+               kubeconfig: pointer.Of[string](""),
+               Context:    pointer.Of[string](""),
        }
        flags.StringVarP(rootFlags.kubeconfig, KubeConfigFlag, "c", "", 
"Kubernetes configuration file")
        flags.StringVar(rootFlags.Context, ContextFlag, "", "Kubernetes 
configuration context")
-       flags.StringVarP(rootFlags.namespace, NamespaceFlag, "n", 
v1.NamespaceAll, "Kubernetes namespace")
-       flags.StringVarP(rootFlags.dubboNamespace, DubboNamespaceFlag, "i", 
viper.GetString(DubboNamespaceFlag), "Dubbo system namespace")
        return rootFlags
 }
-
-func (r *RootFlags) Namespace() string {
-       return *r.namespace
-}
-
-func (r *RootFlags) DubboNamespace() string {
-       return *r.dubboNamespace
-}
diff --git a/dubboctl/pkg/hub/builder/dockerfile/build.go 
b/dubboctl/pkg/hub/builder/dockerfile/build.go
index 94950428..9ea178f4 100644
--- a/dubboctl/pkg/hub/builder/dockerfile/build.go
+++ b/dubboctl/pkg/hub/builder/dockerfile/build.go
@@ -50,7 +50,6 @@ func (b Builder) Build(ctx context.Context, dc 
*dubbo.DubboConfig) error {
        if err != nil {
                return err
        }
-
        defer resp.Body.Close()
 
        termFd, isTerm := term.GetFdInfo(os.Stderr)
diff --git a/dubboctl/pkg/hub/ssh/agent.go b/dubboctl/pkg/hub/ssh/connection.go
similarity index 100%
rename from dubboctl/pkg/hub/ssh/agent.go
rename to dubboctl/pkg/hub/ssh/connection.go
diff --git a/dubboctl/pkg/sdk/client.go b/dubboctl/pkg/sdk/client.go
index 65734429..acf52010 100644
--- a/dubboctl/pkg/sdk/client.go
+++ b/dubboctl/pkg/sdk/client.go
@@ -232,7 +232,7 @@ func (c *Client) Deploy(ctx context.Context, dc 
*dubbo.DubboConfig, opts ...Depl
 
 func hasInitialized(path string) (bool, error) {
        var err error
-       filename := filepath.Join(path, dubbo.DubboLogFile)
+       filename := filepath.Join(path, dubbo.LogFile)
 
        if _, err = os.Stat(filename); err != nil {
                if os.IsNotExist(err) {
@@ -319,7 +319,7 @@ func runDataDir(root string) error {
 }
 
 var contentiousFiles = []string{
-       dubbo.DubboLogFile,
+       dubbo.LogFile,
        ".gitignore",
 }
 
diff --git a/dubboctl/pkg/sdk/dubbo/config.go b/dubboctl/pkg/sdk/dubbo/config.go
index a19a67cc..f454abaa 100644
--- a/dubboctl/pkg/sdk/dubbo/config.go
+++ b/dubboctl/pkg/sdk/dubbo/config.go
@@ -33,10 +33,12 @@ import (
 )
 
 const (
-       DubboLogFile    = ".dubbo/dubbo.log"
-       Dockerfile      = "Dockerfile"
        DataDir         = ".dubbo"
+       LogFile         = ".dubbo/dubbo.log"
+       Dockerfile      = "Dockerfile"
        DefaultTemplate = "common"
+       builtLogFile    = "built.log"
+       built           = "built"
 )
 
 type DubboConfig struct {
@@ -85,7 +87,7 @@ func NewDubboConfig(path string) (*DubboConfig, error) {
                return nil, fmt.Errorf("function path must be a directory")
        }
 
-       filename := filepath.Join(path, DubboLogFile)
+       filename := filepath.Join(path, LogFile)
        if _, err = os.Stat(filename); err != nil {
                if os.IsNotExist(err) {
                        err = nil
@@ -111,7 +113,7 @@ func NewDubboConfigWithTemplate(dc *DubboConfig, 
initialized bool) *DubboConfig
                        dc.Template = DefaultTemplate
                }
                if dc.Template == "" {
-                       dc.Template = "initialzed"
+                       dc.Template = "initialized"
                }
        }
        if dc.Build.BuilderImages == nil {
@@ -121,7 +123,7 @@ func NewDubboConfigWithTemplate(dc *DubboConfig, 
initialized bool) *DubboConfig
 }
 
 func (dc *DubboConfig) WriteFile() (err error) {
-       file := filepath.Join(dc.Root, DubboLogFile)
+       file := filepath.Join(dc.Root, LogFile)
        var bytes []byte
        if bytes, err = yaml.Marshal(dc); err != nil {
                return
@@ -156,7 +158,7 @@ func (dc *DubboConfig) Validate() error {
        }
 
        var b strings.Builder
-       b.WriteString(fmt.Sprintf("'%v' contains errors:", DubboLogFile))
+       b.WriteString(fmt.Sprintf("'%v' contains errors:", LogFile))
 
        for _, ee := range errs {
                if len(ee) > 0 {
@@ -194,7 +196,7 @@ func (dc *DubboConfig) Built() bool {
 }
 
 func (dc *DubboConfig) buildStamp() string {
-       path := filepath.Join(dc.Root, DataDir, "built")
+       path := filepath.Join(dc.Root, DataDir, built)
        if _, err := os.Stat(path); err != nil {
                return ""
        }
@@ -226,11 +228,11 @@ func (dc *DubboConfig) Stamp(oo ...stampOption) (err 
error) {
                return
        }
 
-       if err = os.WriteFile(filepath.Join(dc.Root, DataDir, "built"), 
[]byte(hash), os.ModePerm); err != nil {
-               return
+       if err = os.WriteFile(filepath.Join(dc.Root, DataDir, built), 
[]byte(hash), os.ModePerm); err != nil {
+               return err
        }
 
-       blt := "built.log"
+       blt := builtLogFile
        if options.log {
                blt = timestamp(blt)
        }
@@ -274,7 +276,7 @@ func Fingerprint(dc *DubboConfig) (hash, log string, err 
error) {
                if info.IsDir() && (info.Name() == DataDir || info.Name() == 
".git" || info.Name() == ".idea") {
                        return filepath.SkipDir
                }
-               if info.Name() == DubboLogFile || info.Name() == Dockerfile || 
info.Name() == output {
+               if info.Name() == LogFile || info.Name() == Dockerfile || 
info.Name() == output {
                        return nil
                }
                fmt.Fprintf(h, "%v:%v:", path, info.ModTime().UnixNano())   // 
Write to the Hashed
diff --git a/dubboctl/pkg/sdk/dubbo/dockerfile.go 
b/dubboctl/pkg/sdk/dubbo/dockerfile.go
index 026002bf..318f8a9b 100644
--- a/dubboctl/pkg/sdk/dubbo/dockerfile.go
+++ b/dubboctl/pkg/sdk/dubbo/dockerfile.go
@@ -23,17 +23,17 @@ FROM golang:1.20-alpine AS builder
 
 LABEL stage=gobuilder
 
-ENV CGO_ENABLED=0
-ENV GOPROXY=https://goproxy.cn,direct
+ENV CGO_ENABLED=0 && GOPROXY=https://goproxy.cn,direct
 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' 
/etc/apk/repositories
 
 WORKDIR /build
 
-ADD go.mod go.sum ./
-RUN go mod download
-
-COPY . ./
+WORKDIR /workspace
+COPY go.mod go.mod
+COPY go.sum go.sum
+COPY . .
 COPY ./conf /app/conf
+
 RUN go build -ldflags="-s -w" -o /app/dubbogo ./cmd
 
 FROM scratch
@@ -45,7 +45,7 @@ COPY --from=builder /app/conf /app/conf
 
 ENV DUBBO_GO_CONFIG_PATH=/app/conf/dubbogo.yaml
 
-CMD ["./dubbogo"]  
+ENTRYPOINT ["./dubbogo"]  
 `
 
        java = `
diff --git a/dubboctl/pkg/validate/validate.go 
b/dubboctl/pkg/validate/validate.go
index 619a9208..39a7b392 100644
--- a/dubboctl/pkg/validate/validate.go
+++ b/dubboctl/pkg/validate/validate.go
@@ -132,7 +132,7 @@ func NewValidateCommand(ctx cli.Context) *cobra.Command {
                Args:    cobra.NoArgs,
                Aliases: []string{"v"},
                RunE: func(cmd *cobra.Command, _ []string) error {
-                       dn := ctx.DubboNamespace()
+                       dn := ctx.Namespace()
                        return validateFiles(&dn, files, cmd.OutOrStderr())
                },
        }
diff --git a/manifests/addons/values-prometheus.yaml 
b/manifests/addons/values-prometheus.yaml
index ae55a8e2..f39f3f00 100644
--- a/manifests/addons/values-prometheus.yaml
+++ b/manifests/addons/values-prometheus.yaml
@@ -15,31 +15,23 @@
 
 alertmanager:
   enabled: false
-
 prometheus-pushgateway:
   enabled: false
-
 kube-state-metrics:
   enabled: false
-
 prometheus-node-exporter:
   enabled: false
-
 server:
   persistentVolume:
     enabled: false
   service:
     servicePort: 9090
   readinessProbeInitialDelay: 0
-
   global:
     scrape_interval: 15s
-
   image:
     repository: prom/prometheus
-
   securityContext: null
-
 configmapReload:
   prometheus:
     image:
diff --git a/operator/cmd/cluster/manifest.go b/operator/cmd/cluster/manifest.go
index 6955fe31..aa3e977b 100644
--- a/operator/cmd/cluster/manifest.go
+++ b/operator/cmd/cluster/manifest.go
@@ -33,14 +33,14 @@ import (
 
 type manifestGenerateArgs struct {
        // filenames is an array of paths to input DubboOperator CR files.
-       filenames []string
+       // filenames []string
        // sets is a string with the format "path=value".
        sets []string
 }
 
 func (a *manifestGenerateArgs) String() string {
        var b strings.Builder
-       b.WriteString("filenames:   " + fmt.Sprint(a.filenames) + "\n")
+       // b.WriteString("filenames:   " + fmt.Sprint(a.filenames) + "\n")
        b.WriteString("sets:           " + fmt.Sprint(a.sets) + "\n")
        return b.String()
 }
@@ -102,7 +102,7 @@ const (
 
 func manifestGenerate(kc kube.CLIClient, mgArgs *manifestGenerateArgs, cl 
clog.Logger) error {
        setFlags := applyFlagAliases(mgArgs.sets)
-       manifests, _, err := render.GenerateManifest(mgArgs.filenames, 
setFlags, cl, kc)
+       manifests, _, err := render.GenerateManifest(nil, setFlags, cl, kc)
        if err != nil {
                return err
        }
diff --git a/operator/cmd/cluster/upgrade.go b/operator/cmd/cluster/upgrade.go
index b9ff26b4..789e7aa2 100644
--- a/operator/cmd/cluster/upgrade.go
+++ b/operator/cmd/cluster/upgrade.go
@@ -37,14 +37,11 @@ func UpgradeCmd(ctx cli.Context) *cobra.Command {
        }
        cmd := &cobra.Command{
                Use:   "upgrade",
-               Short: "Upgrade the Dubbo Control Plane",
+               Short: "Upgrade the Dubbo",
                Long:  "The upgrade command can be used instead of the install 
command",
                Example: `  # Apply a default dubboctl installation.
   dubboctl upgrade
   
-  # Apply a config file.
-  dubboctl upgrade -f dop.yaml
-  
   # Apply a default profile.
   dubboctl upgrade --profile=demo
 
diff --git a/operator/pkg/install/waiter.go b/operator/pkg/install/waiter.go
index 279be738..674344c4 100644
--- a/operator/pkg/install/waiter.go
+++ b/operator/pkg/install/waiter.go
@@ -35,10 +35,10 @@ import (
        "time"
 )
 
-// deployment holds associated replicaSets for a deployment
+// deployment holds associated replicaSet for a deployment
 type deployment struct {
-       replicaSets *appsv1.ReplicaSet
-       deployment  *appsv1.Deployment
+       replicaSet *appsv1.ReplicaSet
+       deployment *appsv1.Deployment
 }
 
 // WaitForResources polls to get the current status of various objects that 
are not immediately ready
@@ -191,7 +191,7 @@ func namespacesReady(namespaces []corev1.Namespace) (bool, 
[]string) {
 func deploymentsReady(cs kubernetes.Interface, deployments []deployment, info 
map[string]string) (bool, []string) {
        var notReady []string
        for _, v := range deployments {
-               if v.replicaSets.Status.ReadyReplicas >= 
*v.deployment.Spec.Replicas {
+               if v.replicaSet.Status.ReadyReplicas >= 
*v.deployment.Spec.Replicas {
                        // Ready
                        continue
                }

Reply via email to