Skip to content

Commit 0c414a4

Browse files
committed
chore: remove kbcli cluster register when enabling addon (#653)
Co-authored-by: wangyelei <wangyelei@users.noreply.github.com> (cherry picked from commit f98389f)
1 parent c81d896 commit 0c414a4

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

pkg/cmd/addon/addon.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1"
3333
"github.com/apecloud/kubeblocks/pkg/constant"
3434
viper "github.com/apecloud/kubeblocks/pkg/viperx"
35+
"github.com/fatih/color"
3536
"github.com/jedib0t/go-pretty/v6/table"
3637
"github.com/spf13/cobra"
3738
"github.com/spf13/pflag"
@@ -49,7 +50,6 @@ import (
4950
"k8s.io/utils/strings/slices"
5051

5152
"github.com/apecloud/kbcli/pkg/action"
52-
clusterCmd "github.com/apecloud/kbcli/pkg/cmd/cluster"
5353
"github.com/apecloud/kbcli/pkg/cmd/plugin"
5454
"github.com/apecloud/kbcli/pkg/printer"
5555
"github.com/apecloud/kbcli/pkg/types"
@@ -228,7 +228,11 @@ func newEnableCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.
228228
util.CheckErr(o.PatchOptions.CmdComplete(cmd))
229229
util.CheckErr(o.PatchOptions.Run())
230230
if isEngineAddon(&o.addon) {
231-
util.CheckErr(clusterCmd.RegisterClusterChart(f, streams, "", name, getAddonVersion(&o.addon), types.ClusterChartsRepoURL))
231+
fmt.Fprintf(o.Out, "addon %s enabled successfully\n", name)
232+
fmt.Fprintf(o.Out, "You can run the following command to register a cluster:\n")
233+
fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" kbcli cluster register %s --engine %s --repo %s --version <cluster-chart-version>\n", name, name, types.ClusterChartsRepoURL)))
234+
fmt.Fprintf(o.Out, "To find available cluster chart versions, run:\n")
235+
fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" helm search repo kubeblocks-addons/%s-cluster --versions\n", name)))
232236
}
233237
}
234238
},

pkg/cmd/addon/install.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/Masterminds/semver/v3"
3030
kbappsv1 "github.com/apecloud/kubeblocks/apis/apps/v1"
3131
"github.com/apecloud/kubeblocks/pkg/constant"
32+
"github.com/fatih/color"
3233
"github.com/spf13/cobra"
3334
helmaction "helm.sh/helm/v3/pkg/action"
3435
"helm.sh/helm/v3/pkg/chart/loader"
@@ -48,7 +49,6 @@ import (
4849
extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1"
4950

5051
"github.com/apecloud/kbcli/pkg/cluster"
51-
clusterCmd "github.com/apecloud/kbcli/pkg/cmd/cluster"
5252
"github.com/apecloud/kbcli/pkg/printer"
5353
"github.com/apecloud/kbcli/pkg/types"
5454
"github.com/apecloud/kbcli/pkg/util"
@@ -149,9 +149,10 @@ func newInstallCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra
149149
util.CheckErr(o.Run(f, streams))
150150
// avoid unnecessary messages for upgrade
151151
fmt.Fprintf(o.Out, "addon %s installed successfully\n", o.name)
152-
if err := clusterCmd.RegisterClusterChart(f, streams, "", o.name, o.clusterChartVersion, o.clusterChartRepo); err != nil {
153-
util.CheckErr(err)
154-
}
152+
fmt.Fprintf(o.Out, "You can run the following command to register a cluster:\n")
153+
fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" kbcli cluster register %s --engine %s --repo %s --version <cluster-chart-version>\n", o.name, o.name, o.clusterChartRepo)))
154+
fmt.Fprintf(o.Out, "To find available cluster chart versions, run:\n")
155+
fmt.Fprint(o.Out, color.GreenString(fmt.Sprintf(" helm search repo kubeblocks-addons/%s-cluster --versions\n", o.name)))
155156
},
156157
}
157158
cmd.Flags().BoolVar(&o.force, "force", false, "force install the addon and ignore the version check")

0 commit comments

Comments
 (0)