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 f971b7a5 [dubboctl] Optimise code naming (#629)
f971b7a5 is described below
commit f971b7a5f38195a50d2f08cabfbf19055fefb8f7
Author: Jian Zhong <[email protected]>
AuthorDate: Fri Feb 28 08:28:21 2025 +0800
[dubboctl] Optimise code naming (#629)
---
operator/cmd/cluster/install.go | 8 ++++----
operator/cmd/cluster/manifest.go | 10 +++++-----
operator/cmd/cluster/uninstall.go | 12 ++++++------
operator/pkg/uninstall/uninstaller.go | 1 -
4 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/operator/cmd/cluster/install.go b/operator/cmd/cluster/install.go
index 4d48b705..cf0301e3 100644
--- a/operator/cmd/cluster/install.go
+++ b/operator/cmd/cluster/install.go
@@ -21,7 +21,7 @@ import (
var InstallerScope = log.RegisterScope("installer")
type installArgs struct {
- files []string
+ filenames []string
sets []string
waitTimeout time.Duration
skipConfirmation bool
@@ -29,14 +29,14 @@ type installArgs struct {
func (i *installArgs) String() string {
var b strings.Builder
- b.WriteString("filenames: " + (fmt.Sprint(i.files) + "\n"))
+ b.WriteString("filenames: " + (fmt.Sprint(i.filenames) + "\n"))
b.WriteString("sets: " + (fmt.Sprint(i.sets) + "\n"))
b.WriteString("waitTimeout: " + fmt.Sprint(i.waitTimeout) + "\n")
return b.String()
}
func addInstallFlags(cmd *cobra.Command, args *installArgs) {
- cmd.PersistentFlags().StringSliceVarP(&args.files, "filenames", "f",
nil, `Path to the file containing the dubboOperator's custom resources.`)
+ cmd.PersistentFlags().StringSliceVarP(&args.filenames, "filenames",
"f", nil, `Path to the file containing the dubboOperator's custom resources.`)
cmd.PersistentFlags().StringArrayVarP(&args.sets, "set", "s", nil,
`Override dubboOperator values, such as selecting profiles, etc.`)
cmd.PersistentFlags().BoolVarP(&args.skipConfirmation,
"skip-confirmation", "y", false, `The skipConfirmation determines whether the
user is prompted for confirmation.`)
cmd.PersistentFlags().DurationVar(&args.waitTimeout, "wait-timeout",
300*time.Second, "Maximum time to wait for Dubbo resources in each component to
be ready.")
@@ -80,7 +80,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)
- manifests, vals, err := render.GenerateManifest(iArgs.files, setFlags,
cl, kubeClient)
+ manifests, vals, err := render.GenerateManifest(iArgs.filenames,
setFlags, cl, kubeClient)
if err != nil {
return fmt.Errorf("generate config: %v", err)
}
diff --git a/operator/cmd/cluster/manifest.go b/operator/cmd/cluster/manifest.go
index 6983099b..3dd34cfa 100644
--- a/operator/cmd/cluster/manifest.go
+++ b/operator/cmd/cluster/manifest.go
@@ -15,19 +15,19 @@ import (
)
type manifestGenerateArgs struct {
- files []string
- sets []string
+ filenames []string
+ sets []string
}
func (a *manifestGenerateArgs) String() string {
var b strings.Builder
- b.WriteString("filenames: " + fmt.Sprint(a.files) + "\n")
+ b.WriteString("filenames: " + fmt.Sprint(a.filenames) + "\n")
b.WriteString("sets: " + fmt.Sprint(a.sets) + "\n")
return b.String()
}
func addManifestGenerateFlags(cmd *cobra.Command, args *manifestGenerateArgs) {
- cmd.PersistentFlags().StringSliceVarP(&args.files, "filename", "f",
nil, ``)
+ cmd.PersistentFlags().StringSliceVarP(&args.filenames, "filename", "f",
nil, ``)
cmd.PersistentFlags().StringArrayVarP(&args.sets, "set", "s", nil, ``)
}
@@ -83,7 +83,7 @@ const (
func manifestGenerate(kc kube.CLIClient, mgArgs *manifestGenerateArgs, cl
clog.Logger) error {
setFlags := applyFlagAliases(mgArgs.sets)
- manifests, _, err := render.GenerateManifest(mgArgs.files, setFlags,
cl, kc)
+ manifests, _, err := render.GenerateManifest(mgArgs.filenames,
setFlags, cl, kc)
if err != nil {
return err
}
diff --git a/operator/cmd/cluster/uninstall.go
b/operator/cmd/cluster/uninstall.go
index b2121bf0..d3ee6eab 100644
--- a/operator/cmd/cluster/uninstall.go
+++ b/operator/cmd/cluster/uninstall.go
@@ -15,7 +15,7 @@ import (
const ()
type uninstallArgs struct {
- files string
+ filenames string
sets []string
manifestPath string
remove bool
@@ -23,7 +23,7 @@ type uninstallArgs struct {
}
func addUninstallFlags(cmd *cobra.Command, args *uninstallArgs) {
- cmd.PersistentFlags().StringVarP(&args.files, "filename", "f", "", "The
filename of the DubboOperator CR.")
+ cmd.PersistentFlags().StringVarP(&args.filenames, "filename", "f", "",
"The filename of the DubboOperator CR.")
cmd.PersistentFlags().StringArrayVarP(&args.sets, "set", "s", nil,
`Override dubboOperator values, such as selecting profiles, etc.`)
cmd.PersistentFlags().BoolVar(&args.remove, "remove", false, `Remove
all dubbo related source code.`)
cmd.PersistentFlags().BoolVarP(&args.skipConfirmation,
"skip-confirmation", "y", false, `The skipConfirmation determines whether the
user is prompted for confirmation.`)
@@ -42,7 +42,7 @@ func UninstallCmd(ctx cli.Context) *cobra.Command {
# Uninstall all control planes and shared resources
dubboctl uninstall --remove`,
Args: func(cmd *cobra.Command, args []string) error {
- if uiArgs.files == "" && !uiArgs.remove {
+ if uiArgs.filenames == "" && !uiArgs.remove {
return fmt.Errorf("at least one of the
--filename or --remove flags must be set")
}
if len(args) > 0 {
@@ -69,15 +69,15 @@ func Uninstall(cmd *cobra.Command, ctx cli.Context,
rootArgs *RootArgs, uiArgs *
}
pl := progress.NewInfo()
- if uiArgs.remove && uiArgs.files != "" {
+ if uiArgs.remove && uiArgs.filenames != "" {
cl.LogAndPrint("Purge uninstall will remove all Dubbo
resources, ignoring the specified revision or operator file")
}
setFlags := applyFlagAliases(uiArgs.sets)
files := []string{}
- if uiArgs.files != "" {
- files = append(files, uiArgs.files)
+ if uiArgs.filenames != "" {
+ files = append(files, uiArgs.filenames)
}
vals, err := render.MergeInputs(files, setFlags)
diff --git a/operator/pkg/uninstall/uninstaller.go
b/operator/pkg/uninstall/uninstaller.go
index 7f5f6212..992a5b79 100644
--- a/operator/pkg/uninstall/uninstaller.go
+++ b/operator/pkg/uninstall/uninstaller.go
@@ -76,7 +76,6 @@ func NamespacedResources() []schema.GroupVersionKind {
gvk.Secret.Kubernetes(),
gvk.ServiceAccount.Kubernetes(),
gvk.Job.Kubernetes(),
- gvk.Namespace.Kubernetes(), // TODO
{Group: "rbac.authorization.k8s.io", Version: "v1", Kind:
"RoleBinding"},
{Group: "rbac.authorization.k8s.io", Version: "v1", Kind:
"Role"},
}