Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/cmd/addon/addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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"
Expand All @@ -49,7 +50,6 @@
"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"
Expand Down Expand Up @@ -228,7 +228,13 @@
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")
msg := color.GreenString(fmt.Sprintf(" kbcli cluster register %s --engine %s --repo %s --version <cluster-chart-version>\n", name, name, types.ClusterChartsRepoURL))
fmt.Fprintf(o.Out, msg)

Check failure on line 234 in pkg/cmd/addon/addon.go

View workflow job for this annotation

GitHub Actions / make-test

printf: non-constant format string in call to fmt.Fprintf (govet)
fmt.Fprintf(o.Out, "To find available cluster chart versions, run:\n")
msg = color.GreenString(fmt.Sprintf(" helm search repo kubeblocks-addons/%s-cluster --versions\n", name))
fmt.Fprintf(o.Out, msg)

Check failure on line 237 in pkg/cmd/addon/addon.go

View workflow job for this annotation

GitHub Actions / make-test

printf: non-constant format string in call to fmt.Fprintf (govet)
}
}
},
Expand Down
11 changes: 7 additions & 4 deletions pkg/cmd/addon/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"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"
Expand All @@ -48,7 +49,6 @@
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"
Expand Down Expand Up @@ -149,9 +149,12 @@
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")
msg := color.GreenString(fmt.Sprintf(" kbcli cluster register %s --engine %s --repo %s --version <cluster-chart-version>\n", o.name, o.name, o.clusterChartRepo))
fmt.Fprintf(o.Out, msg)

Check failure on line 154 in pkg/cmd/addon/install.go

View workflow job for this annotation

GitHub Actions / make-test

printf: non-constant format string in call to fmt.Fprintf (govet)
fmt.Fprintf(o.Out, "To find available cluster chart versions, run:\n")
msg = color.GreenString(fmt.Sprintf(" helm search repo kubeblocks-addons/%s-cluster --versions\n", o.name))
fmt.Fprintf(o.Out, msg)
},
}
cmd.Flags().BoolVar(&o.force, "force", false, "force install the addon and ignore the version check")
Expand Down
Loading