You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by zh...@apache.org on 2024/12/15 00:53:31 UTC

(dubbo-kubernetes) branch master updated: [fix] installer generator error

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 9a3fd5df [fix] installer generator error
9a3fd5df is described below

commit 9a3fd5df3702b3aa02395ce9702deccdeedc0e4a
Author: mfordjody <11...@qq.com>
AuthorDate: Sun Dec 15 08:53:21 2024 +0800

    [fix] installer generator error
---
 operator/cmd/cluster/install.go | 15 ++++++++++-----
 operator/pkg/render/manifest.go |  7 ++++---
 pkg/kube/client.go              |  1 +
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/operator/cmd/cluster/install.go b/operator/cmd/cluster/install.go
index 41af1d7c..a9f2f289 100644
--- a/operator/cmd/cluster/install.go
+++ b/operator/cmd/cluster/install.go
@@ -46,11 +46,16 @@ func InstallCmdWithArgs(ctx cli.Context, rootArgs *RootArgs, iArgs *installArgs)
 		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.
+		Example: `
+        # Apply a default dubboctl installation.
 		dubboctl install
 		# Apply a default profile.
-		dubboctl install --profile=default`,
-		Args: cobra.ExactArgs(0),
+		dubboctl install --profile=default
+		# Apply a config file
+		dubboctl install -f my-config.yaml
+		`,
+		Aliases: []string{"apply"},
+		Args:    cobra.ExactArgs(0),
 		RunE: func(cmd *cobra.Command, args []string) error {
 			kubeClient, err := ctx.CLIClient()
 			if err != nil {
@@ -59,7 +64,7 @@ func InstallCmdWithArgs(ctx cli.Context, rootArgs *RootArgs, iArgs *installArgs)
 			p := NewPrinterForWriter(cmd.OutOrStderr())
 			cl := clog.NewConsoleLogger(cmd.OutOrStdout(), cmd.ErrOrStderr(), installerScope)
 			p.Printf("%v\n", art.DubboArt())
-			return Install(kubeClient, rootArgs, iArgs, cl, cmd.OutOrStdout(), p)
+			return Install(kubeClient, rootArgs, iArgs)
 		},
 	}
 	return ic
@@ -67,7 +72,7 @@ func InstallCmdWithArgs(ctx cli.Context, rootArgs *RootArgs, iArgs *installArgs)
 
 func Install(kubeClient kube.CLIClient, rootArgs *RootArgs, iArgs *installArgs, cl clog.Logger, stdOut io.Writer, p Printer) error {
 	setFlags := applyFlagAliases(iArgs.Sets, iArgs.ManifestPath, iArgs.Revision)
-	manifests, vals, err := render.GenerateManifest(iArgs.Files, setFlags, cl)
+	manifests, vals, err := render.GenerateManifest(iArgs.Files, setFlags, cl, kubeClient)
 	if err != nil {
 		return fmt.Errorf("generate config: %v", err)
 	}
diff --git a/operator/pkg/render/manifest.go b/operator/pkg/render/manifest.go
index cab6091d..30c0d27b 100644
--- a/operator/pkg/render/manifest.go
+++ b/operator/pkg/render/manifest.go
@@ -11,12 +11,13 @@ import (
 	"github.com/apache/dubbo-kubernetes/operator/pkg/util"
 	"github.com/apache/dubbo-kubernetes/operator/pkg/util/clog"
 	"github.com/apache/dubbo-kubernetes/operator/pkg/values"
+	"github.com/apache/dubbo-kubernetes/pkg/kube"
 	"io"
 	"os"
 	"strings"
 )
 
-func MergeInputs(filenames []string, flags []string) (values.Map, error) {
+func MergeInputs(filenames []string, flags []string, client kube.Client) (values.Map, error) {
 	ConfigBase, err := values.MapFromJSON([]byte(`{
 	  "apiVersion": "install.dubbo.io/v1alpha1",
 	  "kind": "DubboOperator",
@@ -104,9 +105,9 @@ func checkDops(s string) error {
 	}
 	return nil
 }
-func GenerateManifest(files []string, setFlags []string, logger clog.Logger) ([]manifest.ManifestSet, values.Map, error) {
+func GenerateManifest(files []string, setFlags []string, logger clog.Logger, client kube.Client) ([]manifest.ManifestSet, values.Map, error) {
 	var chartWarnings util.Errors
-	merged, err := MergeInputs(files, setFlags)
+	merged, err := MergeInputs(files, setFlags, client)
 	if err != nil {
 		return nil, nil, fmt.Errorf("merge inputs: %v", err)
 	}
diff --git a/pkg/kube/client.go b/pkg/kube/client.go
index 21a532ac..77098a2c 100644
--- a/pkg/kube/client.go
+++ b/pkg/kube/client.go
@@ -26,6 +26,7 @@ type Client interface {
 }
 
 type CLIClient interface {
+	Client
 	DynamicClientFor(gvk schema.GroupVersionKind, obj *unstructured.Unstructured, namespace string) (dynamic.ResourceInterface, error)
 }