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 1619b119 [dubboctl] Deletion of obsolete resources
1619b119 is described below

commit 1619b11991873fc464ac50e01cc1f50eb506b8c9
Author: mfordjody <[email protected]>
AuthorDate: Wed Jan 1 09:08:41 2025 +0800

    [dubboctl] Deletion of obsolete resources
---
 dubboctl/pkg/manifest/common.go    |  26 -----
 dubboctl/pkg/manifest/diff.go      | 181 -----------------------------
 dubboctl/pkg/manifest/generate.go  | 226 -------------------------------------
 dubboctl/pkg/manifest/install.go   | 104 -----------------
 dubboctl/pkg/manifest/uninstall.go |  89 ---------------
 dubboctl/pkg/profile/diff.go       | 108 ------------------
 dubboctl/pkg/profile/list.go       | 112 ------------------
 7 files changed, 846 deletions(-)

diff --git a/dubboctl/pkg/manifest/common.go b/dubboctl/pkg/manifest/common.go
deleted file mode 100644
index 88861815..00000000
--- a/dubboctl/pkg/manifest/common.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package manifest
-
-import (
-       "sigs.k8s.io/controller-runtime/pkg/client"
-)
-
-var (
-       // TestInstallFlag and TestCli are uses for black box testing
-       TestInstallFlag bool
-       TestCli         client.Client
-)
diff --git a/dubboctl/pkg/manifest/diff.go b/dubboctl/pkg/manifest/diff.go
deleted file mode 100644
index c3a12c25..00000000
--- a/dubboctl/pkg/manifest/diff.go
+++ /dev/null
@@ -1,181 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package manifest
-
-//import (
-//     "errors"
-//     "fmt"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
-//     "os"
-//     "path/filepath"
-//     "strings"
-//)
-//
-//import (
-//     "github.com/spf13/cobra"
-//
-//     "go.uber.org/zap/zapcore"
-//)
-//
-//import (
-//     "github.com/apache/dubbo-kubernetes/pkg/core/logger"
-//)
-//
-//type ManifestDiffArgs struct {
-//     CompareDir bool
-//}
-//
-//func ConfigManifestDiffCmd(baseCmd *cobra.Command) {
-//     mdArgs := &ManifestDiffArgs{}
-//     mdCmd := &cobra.Command{
-//             Use:   "diff",
-//             Short: "show the difference between two files or dirs",
-//             Example: `  # show the difference between two files
-//  dubboctl manifest diff fileA fileB
-//  # show the difference between two dirs
-//  dubboctl manifest diff dirA dirB --compareDir=true
-//`,
-//             Args: func(cmd *cobra.Command, args []string) error {
-//                     if len(args) != 2 {
-//                             return fmt.Errorf("manifest diff needs two 
files or dirs")
-//                     }
-//                     return nil
-//             },
-//             RunE: func(cmd *cobra.Command, args []string) error {
-//                     logger.InitCmdSugar(zapcore.AddSync(cmd.OutOrStdout()))
-//                     if err := compare(args, mdArgs); err != nil {
-//                             return err
-//                     }
-//                     return nil
-//             },
-//     }
-//     mdCmd.PersistentFlags().BoolVarP(&mdArgs.CompareDir, "compareDir", "", 
false,
-//             "Indicate whether compare two dirs or two files")
-//
-//     baseCmd.AddCommand(mdCmd)
-//}
-//
-//func compare(args []string, mdArgs *ManifestDiffArgs) error {
-//     var res string
-//     var err error
-//     if mdArgs.CompareDir {
-//             res, err = compareDirs(args[0], args[1])
-//     } else {
-//             res, err = compareFiles(args[0], args[1])
-//     }
-//     if err != nil {
-//             return err
-//     }
-//     logger.CmdSugar().Print(res)
-//     return nil
-//}
-//
-//func compareDirs(dirA, dirB string) (string, error) {
-//     filesA, err := os.ReadDir(dirA)
-//     if err != nil {
-//             return "", err
-//     }
-//     filesB, err := os.ReadDir(dirB)
-//     if err != nil {
-//             return "", err
-//     }
-//     createFileMap := func(dir string, files []os.DirEntry) 
(map[string]struct{}, error) {
-//             res := make(map[string]struct{})
-//             for _, file := range files {
-//                     if file.IsDir() {
-//                             return nil, errors.New("do not support 
recursive traversal")
-//                     }
-//                     res[file.Name()] = struct{}{}
-//             }
-//             return res, nil
-//     }
-//     mapA, err := createFileMap(dirA, filesA)
-//     if err != nil {
-//             return "", err
-//     }
-//     mapB, err := createFileMap(dirB, filesB)
-//     if err != nil {
-//             return "", err
-//     }
-//     var diffBuilder strings.Builder
-//     var addBuilder strings.Builder
-//     var errBuilder strings.Builder
-//     for file := range mapA {
-//             if _, ok := mapB[file]; ok {
-//                     fileA := filepath.Join(dirA, file)
-//                     fileB := filepath.Join(dirB, file)
-//                     res, err := compareFiles(fileA, fileB)
-//                     if err != nil {
-//                             errBuilder.WriteString(err.Error() + "\n")
-//                             continue
-//                     }
-//                     if res != "" {
-//                             
diffBuilder.WriteString(fmt.Sprintf("%s---%s\n", fileA, fileB))
-//                             diffBuilder.WriteString(res + "\n")
-//                     }
-//             } else {
-//                     addBuilder.WriteString(fmt.Sprintf("%s doesn't exist in 
%s\n", file, dirB))
-//             }
-//     }
-//     for file := range mapB {
-//             if _, ok := mapA[file]; !ok {
-//                     addBuilder.WriteString(fmt.Sprintf("%s doesn't exist in 
%s\n", file, dirA))
-//             }
-//     }
-//     errRes := errBuilder.String()
-//     if errRes != "" {
-//             errRes = "------parse error------\n" + errRes + "\n"
-//     }
-//     addRes := addBuilder.String()
-//     if addRes != "" {
-//             addRes = "------addition------\n" + addRes + "\n"
-//     }
-//     diffRes := diffBuilder.String()
-//     if diffRes != "" {
-//             diffRes = "------diff------\n" + diffRes + "\n"
-//     }
-//
-//     var final string
-//     if errRes == "" && addRes == "" && diffRes == "" {
-//             final = "two dirs are identical\n"
-//     } else {
-//             final = errRes + addRes + diffRes
-//     }
-//
-//     return final, nil
-//}
-//
-//func compareFiles(fileA, fileB string) (string, error) {
-//     bytesA, err := os.ReadFile(fileA)
-//     if err != nil {
-//             return "", fmt.Errorf("read %s failed, err: %s", fileA, err)
-//     }
-//     bytesB, err := os.ReadFile(fileB)
-//     if err != nil {
-//             return "", fmt.Errorf("read %s failed, err: %s", fileB, err)
-//     }
-//     objsA, err := kube.ParseObjectsFromManifest(string(bytesA), false)
-//     if err != nil {
-//             return "", fmt.Errorf("parse %s failed, err: %s", fileA, err)
-//     }
-//     objsB, err := kube.ParseObjectsFromManifest(string(bytesB), false)
-//     if err != nil {
-//             return "", fmt.Errorf("parse %s failed, err: %s", fileA, err)
-//     }
-//     diffRes, addRes, errRes := kube.CompareObjects(objsA, objsB)
-//
-//     return diffRes + addRes + errRes, nil
-//}
diff --git a/dubboctl/pkg/manifest/generate.go 
b/dubboctl/pkg/manifest/generate.go
deleted file mode 100644
index 3dea7262..00000000
--- a/dubboctl/pkg/manifest/generate.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package manifest
-
-//import (
-//     "fmt"
-//     "github.com/apache/dubbo-kubernetes/operator/manifest"
-//     "github.com/apache/dubbo-kubernetes/operator/manifest/render"
-//     
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/util"
-//     "os"
-//     "path"
-//     "sort"
-//     "strings"
-//)
-//
-//import (
-//     "github.com/spf13/cobra"
-//
-//     "go.uber.org/zap/zapcore"
-//
-//     "sigs.k8s.io/yaml"
-//)
-//
-//import (
-//     "github.com/apache/dubbo-kubernetes/pkg/core/logger"
-//)
-//
-//type ManifestGenerateArgs struct {
-//     FileNames    []string
-//     ChartsPath   string
-//     ProfilesPath string
-//     OutputPath   string
-//     SetFlags     []string
-//}
-//
-//func (mga *ManifestGenerateArgs) setDefault() {
-//     if mga == nil {
-//             return
-//     }
-//     if mga.ProfilesPath == "" {
-//             mga.ProfilesPath = identifier.Profiles
-//     }
-//     if mga.ChartsPath == "" {
-//             mga.ChartsPath = identifier.Charts
-//     }
-//}
-//
-//func ConfigManifestGenerateCmd(baseCmd *cobra.Command) {
-//     mgArgs := &ManifestGenerateArgs{}
-//     mgCmd := &cobra.Command{
-//             Use:   "generate",
-//             Short: "Generate dubbo control plane manifest to apply",
-//             Example: `  # Generate a default Dubbo control plane manifest
-//  dubboctl manifest generate
-//
-//  # Setting specification of built-in bootstrap
-//  dubboctl manifest generate --set spec.components.nacos.replicas=3
-//
-//  # Setting specification of add-on bootstrap
-//  dubboctl manifest generate --set spec.components.grafana.replicas=3
-//
-//  # Disabling bootstrap
-//  dubboctl manifest generate --set spec.componentsMeta.nacos.enabled=false
-//
-//  # Setting repository url and version of remote chart
-//  dubboctl manifest generate --set 
spec.componentsMeta.grafana.repoURL=https://grafana.github.io/helm-charts --set 
spec.componentsMeta.grafana.version=6.31.0
-//
-//  # Generate manifest to target path
-//  dubboctl manifest generate -o /path/to/temp
-//
-//  # Input user specified yaml
-//  dubboctl manifest generate -f /path/to/user.yaml
-//`,
-//             RunE: func(cmd *cobra.Command, args []string) error {
-//                     logger.InitCmdSugar(zapcore.AddSync(cmd.OutOrStdout()))
-//                     mgArgs.setDefault()
-//                     cfg, _, err := generateValues(mgArgs)
-//                     if err != nil {
-//                             return err
-//                     }
-//                     if err := generateManifests(mgArgs, cfg); err != nil {
-//                             return err
-//                     }
-//                     return nil
-//             },
-//     }
-//     addManifestGenerateFlags(mgCmd, mgArgs)
-//
-//     baseCmd.AddCommand(mgCmd)
-//}
-//
-//func addManifestGenerateFlags(cmd *cobra.Command, args 
*ManifestGenerateArgs) {
-//     cmd.PersistentFlags().StringSliceVarP(&args.FileNames, "filenames", 
"f", nil,
-//             "User-defined DubboConfig yaml files, the previous file would 
be overlaid by later file")
-//     cmd.PersistentFlags().StringVarP(&args.ChartsPath, "charts", "", "",
-//             "Path to charts directory, this directory contains components 
charts")
-//     cmd.PersistentFlags().StringVarP(&args.ProfilesPath, "profiles", "", "",
-//             "Path to profiles directory, this directory contains preset 
profiles, default to built-in profiles")
-//     cmd.PersistentFlags().StringVarP(&args.OutputPath, "output", "o", "",
-//             "Path to output manifest, if not set, dubboctl would print the 
manifest")
-//     cmd.PersistentFlags().StringArrayVarP(&args.SetFlags, "set", "s", nil,
-//             "Set DubboConfig fields, see 
/pkg/dubboctl/internal/apis/dubbo.apache.org/v1alpha1/types.go")
-//}
-//
-//// In order to generate values.yaml for helm charts, dubboctl takes 
following order to overlay:
-////
-////  1. mergedYaml, profile <- user1.yaml <- user2.yaml <- user3.yaml ...
-////
-////     User set FileNames, dubboctl reads these user-defined DubboConfig 
yamls and overlays them from back to front.
-////     mergedYaml is the overlaid result.
-////     User could set required profile name by user-defined DubboConfig 
yamls or SetFlag. If none are set, dubboctl
-////     would use default profile. The priority is default profile < 
user-defined DubboConfig yaml < SetFlag.
-////
-////  2. profileYaml <- profile
-////
-////     dubboctl reads profile yaml. Profile can be considered the 
recommended configuration in some classic scenarios.
-////     For now, there is only default.yaml.
-////
-////  3. finalYaml <- profileYaml <- mergedYaml <- SetFlags
-////
-////     Based on profileYaml, user-defined yaml and setFlags are overlaid in 
order.
-////
-////  4. Marshal finalYaml to DubboConfig, And use DubboConfig to represent 
values.yaml and other information.
-//func generateValues(mgArgs *ManifestGenerateArgs) (*v1alpha1.DubboConfig, 
string, error) {
-//     mergedYaml, profile, err := 
manifest.ReadYamlAndProfile(mgArgs.FileNames, mgArgs.SetFlags)
-//     if err != nil {
-//             return nil, "", fmt.Errorf("process user specification failed, 
err: %s", err)
-//     }
-//     profileYaml, err := 
manifest.ReadOverlayProfileYaml(mgArgs.ProfilesPath, profile)
-//     if err != nil {
-//             return nil, "", fmt.Errorf("process profile failed, err: %s", 
err)
-//     }
-//     finalYaml, err := util.OverlayYAML(profileYaml, mergedYaml)
-//     if err != nil {
-//             return nil, "", err
-//     }
-//     finalYaml, err = manifest.OverlaySetFlags(finalYaml, mgArgs.SetFlags)
-//     if err != nil {
-//             return nil, "", fmt.Errorf("process set flags failed, err: %s", 
err)
-//     }
-//     cfg := &v1alpha1.DubboConfig{}
-//     if err := yaml.Unmarshal([]byte(finalYaml), cfg); err != nil {
-//             return nil, "", fmt.Errorf("set flags specification is wrong, 
err: %s", err)
-//     }
-//     // we should ensure that Components field would not be nil
-//     if cfg.Spec.Components == nil {
-//             cfg.Spec.Components = &v1alpha1.DubboComponentsSpec{}
-//     }
-//     cfg.Spec.ProfilePath = mgArgs.ProfilesPath
-//     cfg.Spec.ChartPath = mgArgs.ChartsPath
-//     return cfg, finalYaml, nil
-//}
-//
-//func generateManifests(mgArgs *ManifestGenerateArgs, cfg 
*v1alpha1.DubboConfig) error {
-//     op, err := kube.NewDubboOperator(cfg.Spec, nil)
-//     if err != nil {
-//             return err
-//     }
-//     if err := op.Run(); err != nil {
-//             return err
-//     }
-//     manifestMap, err := op.RenderManifest()
-//     if err != nil {
-//             return err
-//     }
-//     if mgArgs.OutputPath == "" {
-//             // in order to have the same manifest output every time with 
the same input
-//             res, err := sortManifests(manifestMap)
-//             if err != nil {
-//                     return err
-//             }
-//             logger.CmdSugar().Print(res)
-//     } else {
-//             if err := writeManifests(manifestMap, mgArgs.OutputPath); err 
!= nil {
-//                     return err
-//             }
-//     }
-//     return nil
-//}
-//
-//func sortManifests(manifestMap map[kube.ComponentName]string) (string, 
error) {
-//     var names []string
-//     var resBuilder strings.Builder
-//     for name := range manifestMap {
-//             names = append(names, string(name))
-//     }
-//     sort.Strings(names)
-//     for _, name := range names {
-//             file := manifestMap[kube.ComponentName(name)]
-//             if !strings.HasSuffix(file, render.YAMLSeparator) {
-//                     resBuilder.WriteString(file + render.YAMLSeparator)
-//             } else {
-//                     resBuilder.WriteString(file)
-//             }
-//     }
-//     return resBuilder.String(), nil
-//}
-//
-//func writeManifests(manifestMap map[kube.ComponentName]string, outputPath 
string) error {
-//     if err := os.MkdirAll(outputPath, os.ModePerm); err != nil {
-//             return err
-//     }
-//     for name, val := range manifestMap {
-//             filename := path.Join(outputPath, string(name)+".yaml")
-//             if err := os.WriteFile(filename, []byte(val), 0o644); err != 
nil {
-//                     return err
-//             }
-//     }
-//     return nil
-//}
diff --git a/dubboctl/pkg/manifest/install.go b/dubboctl/pkg/manifest/install.go
deleted file mode 100644
index 8ac9cf2e..00000000
--- a/dubboctl/pkg/manifest/install.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package manifest
-
-//import (
-//     
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
-//     "github.com/spf13/cobra"
-//
-//     "go.uber.org/zap/zapcore"
-//)
-//
-//import (
-//     "github.com/apache/dubbo-kubernetes/pkg/core/logger"
-//)
-//
-//type ManifestInstallArgs struct {
-//     ManifestGenerateArgs
-//     KubeConfigPath string
-//     // selected cluster info of kubeconfig
-//     Context string
-//}
-//
-//func (mia *ManifestInstallArgs) setDefault() {
-//     mia.ManifestGenerateArgs.setDefault()
-//}
-//
-//func ConfigManifestInstallCmd(baseCmd *cobra.Command) {
-//     miArgs := &ManifestInstallArgs{}
-//     mgArgs := &miArgs.ManifestGenerateArgs
-//     miCmd := &cobra.Command{
-//             Use:   "install",
-//             Short: "install dubbo control plane",
-//             Example: `  # Install a default Dubbo control plane
-//  dubboctl manifest install
-//
-//  # Install the demo environment
-//  dubboctl manifest install --set profile=demo
-//`,
-//             RunE: func(cmd *cobra.Command, args []string) error {
-//                     logger.InitCmdSugar(zapcore.AddSync(cmd.OutOrStdout()))
-//                     miArgs.setDefault()
-//                     cfg, _, err := generateValues(mgArgs)
-//                     if err != nil {
-//                             return err
-//                     }
-//                     if err := installManifests(miArgs, cfg); err != nil {
-//                             return err
-//                     }
-//                     return nil
-//             },
-//     }
-//     addManifestGenerateFlags(miCmd, mgArgs)
-//     miCmd.PersistentFlags().StringVarP(&miArgs.KubeConfigPath, 
"kubeConfig", "", "",
-//             "Path to kubeconfig")
-//     miCmd.PersistentFlags().StringVarP(&miArgs.Context, "context", "", "",
-//             "Context in kubeconfig to use")
-//
-//     baseCmd.AddCommand(miCmd)
-//}
-//
-//func installManifests(miArgs *ManifestInstallArgs, cfg 
*v1alpha1.DubboConfig) error {
-//     var cliOpts []kube.CtlClientOption
-//     //if cmd.TestInstallFlag {
-//     //      cliOpts = []kube.CtlClientOption{kube.WithCli(cmd.TestCli)}
-//     //} else {
-//     //      cliOpts = []kube.CtlClientOption{
-//     //              kube.WithKubeConfigPath(miArgs.KubeConfigPath),
-//     //              kube.WithContext(miArgs.Context),
-//     //      }
-//     //}
-//     cli, err := kube.NewCtlClient(cliOpts...)
-//     if err != nil {
-//             return err
-//     }
-//     op, err := kube.NewDubboOperator(cfg.Spec, cli)
-//     if err != nil {
-//             return err
-//     }
-//     if err := op.Run(); err != nil {
-//             return err
-//     }
-//     manifestMap, err := op.RenderManifest()
-//     if err != nil {
-//             return err
-//     }
-//     if err := op.ApplyManifest(manifestMap); err != nil {
-//             return err
-//     }
-//     return nil
-//}
diff --git a/dubboctl/pkg/manifest/uninstall.go 
b/dubboctl/pkg/manifest/uninstall.go
deleted file mode 100644
index a4a76fb3..00000000
--- a/dubboctl/pkg/manifest/uninstall.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package manifest
-
-//type ManifestUninstallArgs struct {
-//     ManifestGenerateArgs
-//     KubeConfigPath string
-//     // selected cluster info of kubeconfig
-//     Context string
-//}
-//
-//func (mua *ManifestUninstallArgs) setDefault() {
-//     mua.ManifestGenerateArgs.setDefault()
-//}
-//
-//func ConfigManifestUninstallCmd(baseCmd *cobra.Command) {
-//     muArgs := &ManifestUninstallArgs{}
-//     mgArgs := &muArgs.ManifestGenerateArgs
-//     muCmd := &cobra.Command{
-//             Use:   "uninstall",
-//             Short: "uninstall dubbo control plane",
-//             Example: `  # Uninstall a default Dubbo control plane
-//  dubboctl manifest uninstall
-//`,
-//             RunE: func(cmd *cobra.Command, args []string) error {
-//                     logger.InitCmdSugar(zapcore.AddSync(cmd.OutOrStdout()))
-//                     muArgs.setDefault()
-//                     cfg, _, err := generateValues(mgArgs)
-//                     if err != nil {
-//                             return err
-//                     }
-//                     if err := uninstallManifests(muArgs, cfg); err != nil {
-//                             return err
-//                     }
-//                     return nil
-//             },
-//     }
-//     addManifestGenerateFlags(muCmd, mgArgs)
-//     muCmd.PersistentFlags().StringVarP(&muArgs.KubeConfigPath, 
"kubeConfig", "", "",
-//             "Path to kubeconfig")
-//     muCmd.PersistentFlags().StringVarP(&muArgs.Context, "context", "", "",
-//             "Context in kubeconfig to use")
-//
-//     baseCmd.AddCommand(muCmd)
-//}
-//
-//func uninstallManifests(muArgs *ManifestUninstallArgs, cfg 
*v1alpha1.DubboConfig) error {
-//     var cliOpts []kube.CtlClientOption
-//     //if cmd.TestInstallFlag {
-//     //      cliOpts = []kube.CtlClientOption{kube.WithCli(cmd.TestCli)}
-//     //} else {
-//     //      cliOpts = []kube.CtlClientOption{
-//     //              kube.WithKubeConfigPath(muArgs.KubeConfigPath),
-//     //              kube.WithContext(muArgs.Context),
-//     //      }
-//     //}
-//     cli, err := kube.NewCtlClient(cliOpts...)
-//     if err != nil {
-//             return err
-//     }
-//     op, err := kube.NewDubboOperator(cfg.Spec, cli)
-//     if err != nil {
-//             return err
-//     }
-//     if err := op.Run(); err != nil {
-//             return err
-//     }
-//     manifestMap, err := op.RenderManifest()
-//     if err != nil {
-//             return err
-//     }
-//     if err := op.RemoveManifest(manifestMap); err != nil {
-//             return err
-//     }
-//     return nil
-//}
diff --git a/dubboctl/pkg/profile/diff.go b/dubboctl/pkg/profile/diff.go
deleted file mode 100644
index 75e6f36a..00000000
--- a/dubboctl/pkg/profile/diff.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package profile
-
-//import (
-//     "errors"
-//     "fmt"
-//     "github.com/apache/dubbo-kubernetes/operator/manifest"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
-//)
-//
-//import (
-//     "github.com/spf13/cobra"
-//
-//     "go.uber.org/zap/zapcore"
-//)
-//
-//import (
-//     "github.com/apache/dubbo-kubernetes/pkg/core/logger"
-//)
-//
-//type ProfileDiffArgs struct {
-//     ProfilesPath string
-//}
-//
-//func (pda *ProfileDiffArgs) setDefault() {
-//     if pda == nil {
-//             return
-//     }
-//     if pda.ProfilesPath == "" {
-//             pda.ProfilesPath = identifier.Profiles
-//     }
-//}
-//
-//func ConfigProfileDiffCmd(baseCmd *cobra.Command) {
-//     pdArgs := &ProfileDiffArgs{}
-//     pdCmd := &cobra.Command{
-//             Use:   "diff",
-//             Short: "Show the difference between two profiles",
-//             Example: `  # show the difference between two profiles provided 
by dubbo-admin
-//  dubboctl profile diff default demo
-//
-//  # show the difference between two profiles specified by user
-//  dubboctl profile diff profile_name0 profile_name1 --profiles 
/path/to/profiles
-//`,
-//             Args: func(cmd *cobra.Command, args []string) error {
-//                     if len(args) != 2 {
-//                             return errors.New("profile diff needs two 
profiles")
-//                     }
-//                     return nil
-//             },
-//             RunE: func(cmd *cobra.Command, args []string) error {
-//                     logger.InitCmdSugar(zapcore.AddSync(cmd.OutOrStdout()))
-//                     pdArgs.setDefault()
-//                     if err := profileDiffCmd(pdArgs, args); err != nil {
-//                             return err
-//                     }
-//                     return nil
-//             },
-//     }
-//     pdCmd.PersistentFlags().StringVarP(&pdArgs.ProfilesPath, "profiles", 
"", "",
-//             "Path to profiles directory, this directory contains preset 
profiles")
-//
-//     baseCmd.AddCommand(pdCmd)
-//}
-//
-//func profileDiffCmd(pdArgs *ProfileDiffArgs, args []string) error {
-//     profileA, err := manifest.ReadProfileYaml(pdArgs.ProfilesPath, args[0])
-//     if err != nil {
-//             return fmt.Errorf("parse %s profile failed, err: %s", args[0], 
err)
-//     }
-//     profileB, err := manifest.ReadProfileYaml(pdArgs.ProfilesPath, args[1])
-//     if err != nil {
-//             return fmt.Errorf("parse %s profile failed, err: %s", args[1], 
err)
-//     }
-//     objA, err := kube.ParseObjectFromManifest(profileA)
-//     if err != nil {
-//             return fmt.Errorf("parse %s profile to k8s object failed, err: 
%s", args[0], err)
-//     }
-//     objB, err := kube.ParseObjectFromManifest(profileB)
-//     if err != nil {
-//             return fmt.Errorf("parse %s profile to k8s object failed, err: 
%s", args[1], err)
-//     }
-//     diff, err := kube.CompareObject(objA, objB)
-//     if err != nil {
-//             return fmt.Errorf("compare failed, err: %s", err)
-//     }
-//     if diff != "" {
-//             logger.CmdSugar().Print(diff)
-//     } else {
-//             logger.CmdSugar().Print("two profiles are identical\n")
-//     }
-//     return nil
-//}
diff --git a/dubboctl/pkg/profile/list.go b/dubboctl/pkg/profile/list.go
deleted file mode 100644
index 9276b49d..00000000
--- a/dubboctl/pkg/profile/list.go
+++ /dev/null
@@ -1,112 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package profile
-
-//import (
-//     "errors"
-//     "github.com/apache/dubbo-kubernetes/operator/manifest"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
-//     "github.com/apache/dubbo-kubernetes/operator/pkg/util"
-//     "strings"
-//)
-//
-//import (
-//     "github.com/spf13/cobra"
-//
-//     "go.uber.org/zap/zapcore"
-//)
-//
-//import (
-//     "github.com/apache/dubbo-kubernetes/pkg/core/logger"
-//)
-//
-//type ProfileListArgs struct {
-//     ProfilesPath string
-//}
-//
-//func (pla *ProfileListArgs) setDefault() {
-//     if pla == nil {
-//             return
-//     }
-//     if pla.ProfilesPath == "" {
-//             pla.ProfilesPath = identifier.Profiles
-//     }
-//}
-//
-//func ConfigProfileListCmd(baseCmd *cobra.Command) {
-//     plArgs := &ProfileListArgs{}
-//     plCmd := &cobra.Command{
-//             Use:   "list",
-//             Short: "List all existing profiles specification",
-//             Example: `  # list all profiles provided by dubbo-admin
-//  dubboctl profile list
-//
-//  # list all profiles in path specified by user
-//  dubboctl profile list --profiles path/to/profiles
-//
-//  # display selected profile
-//  dubboctl profile list default
-//`,
-//             Args: func(cmd *cobra.Command, args []string) error {
-//                     if len(args) > 1 {
-//                             return errors.New("profile list doesn't support 
multi profile")
-//                     }
-//                     return nil
-//             },
-//             RunE: func(cmd *cobra.Command, args []string) error {
-//                     logger.InitCmdSugar(zapcore.AddSync(cmd.OutOrStdout()))
-//                     plArgs.setDefault()
-//                     if err := profileListCmd(plArgs, args); err != nil {
-//                             return err
-//                     }
-//                     return nil
-//             },
-//     }
-//     plCmd.PersistentFlags().StringVarP(&plArgs.ProfilesPath, "profiles", 
"", "",
-//             "Path to profiles directory, this directory contains preset 
profiles")
-//
-//     baseCmd.AddCommand(plCmd)
-//}
-//
-//func profileListCmd(plArgs *ProfileListArgs, args []string) error {
-//     profiles, err := manifest.ReadProfilesNames(plArgs.ProfilesPath)
-//     if err != nil {
-//             return err
-//     }
-//     // list all profiles
-//     if len(args) == 0 {
-//             var resBuilder strings.Builder
-//             resBuilder.WriteString("Dubbo-admin profiles:\n")
-//             for _, profile := range profiles {
-//                     resBuilder.WriteString("    " + profile + "\n")
-//             }
-//             logger.CmdSugar().Print(resBuilder.String())
-//             return nil
-//     }
-//
-//     for _, profile := range profiles {
-//             if profile == args[0] {
-//                     res, err := 
manifest.ReadProfileYaml(plArgs.ProfilesPath, profile)
-//                     if err != nil {
-//                             return err
-//                     }
-//                     logger.CmdSugar().Print(util.ApplyFilters(res, 
util.LicenseFilter, util.SpaceFilter))
-//                     return nil
-//             }
-//     }
-//
-//     return nil
-//}

Reply via email to