diff --git a/addons b/addons index 3dca32705..e381e3de9 160000 --- a/addons +++ b/addons @@ -1 +1 @@ -Subproject commit 3dca32705114aed567891a7bf44201a069e9b32e +Subproject commit e381e3de9cac5d07f7e24ce57dfbc1e86a607503 diff --git a/pkg/cmd/addon/addon.go b/pkg/cmd/addon/addon.go index ae7c0c0d5..54ccc285d 100644 --- a/pkg/cmd/addon/addon.go +++ b/pkg/cmd/addon/addon.go @@ -32,6 +32,7 @@ import ( extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1" "github.com/apecloud/kubeblocks/pkg/constant" viper "github.com/apecloud/kubeblocks/pkg/viperx" + "github.com/fatih/color" "github.com/jedib0t/go-pretty/v6/table" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -49,7 +50,6 @@ import ( "k8s.io/utils/strings/slices" "github.com/apecloud/kbcli/pkg/action" - clusterCmd "github.com/apecloud/kbcli/pkg/cmd/cluster" "github.com/apecloud/kbcli/pkg/cmd/plugin" "github.com/apecloud/kbcli/pkg/printer" "github.com/apecloud/kbcli/pkg/types" @@ -228,7 +228,11 @@ func newEnableCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra. util.CheckErr(o.PatchOptions.CmdComplete(cmd)) util.CheckErr(o.PatchOptions.Run()) if isEngineAddon(&o.addon) { - util.CheckErr(clusterCmd.RegisterClusterChart(f, streams, "", name, getAddonVersion(&o.addon), types.ClusterChartsRepoURL)) + fmt.Fprintf(o.Out, "addon %s enabled successfully\n", name) + fmt.Fprintf(o.Out, "You can run the following command to register a cluster:\n") + fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" kbcli cluster register %s --engine %s --repo %s --version \n", name, name, types.ClusterChartsRepoURL))) + fmt.Fprintf(o.Out, "To find available cluster chart versions, run:\n") + fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" helm search repo kubeblocks-addons/%s-cluster --versions\n", name))) } } }, diff --git a/pkg/cmd/addon/install.go b/pkg/cmd/addon/install.go index d232a3b8c..26e0810ce 100644 --- a/pkg/cmd/addon/install.go +++ b/pkg/cmd/addon/install.go @@ -29,6 +29,7 @@ import ( "github.com/Masterminds/semver/v3" kbappsv1 "github.com/apecloud/kubeblocks/apis/apps/v1" "github.com/apecloud/kubeblocks/pkg/constant" + "github.com/fatih/color" "github.com/spf13/cobra" helmaction "helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/chart/loader" @@ -48,7 +49,6 @@ import ( extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1" "github.com/apecloud/kbcli/pkg/cluster" - clusterCmd "github.com/apecloud/kbcli/pkg/cmd/cluster" "github.com/apecloud/kbcli/pkg/printer" "github.com/apecloud/kbcli/pkg/types" "github.com/apecloud/kbcli/pkg/util" @@ -149,9 +149,10 @@ func newInstallCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra util.CheckErr(o.Run(f, streams)) // avoid unnecessary messages for upgrade fmt.Fprintf(o.Out, "addon %s installed successfully\n", o.name) - if err := clusterCmd.RegisterClusterChart(f, streams, "", o.name, o.clusterChartVersion, o.clusterChartRepo); err != nil { - util.CheckErr(err) - } + fmt.Fprintf(o.Out, "You can run the following command to register a cluster:\n") + fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" kbcli cluster register %s --engine %s --repo %s --version \n", o.name, o.name, o.clusterChartRepo))) + fmt.Fprintf(o.Out, "To find available cluster chart versions, run:\n") + fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" helm search repo kubeblocks-addons/%s-cluster --versions\n", o.name))) }, } cmd.Flags().BoolVar(&o.force, "force", false, "force install the addon and ignore the version check")