Skip to content

Commit 232380e

Browse files
committed
chore: skip wait for addons ready if addon list is empty (#623)
(cherry picked from commit 6efc4fb)
1 parent 2344eb9 commit 232380e

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

pkg/cmd/cluster/config_ops.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ import (
3030
cfgcm "github.com/apecloud/kubeblocks/pkg/configuration/config_manager"
3131
"github.com/apecloud/kubeblocks/pkg/configuration/core"
3232
configctrl "github.com/apecloud/kubeblocks/pkg/controller/configuration"
33-
"github.com/apecloud/kubeblocks/pkg/controllerutil"
34-
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
33+
controllerutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
3534
"github.com/apecloud/kubeblocks/pkg/generics"
3635
"github.com/spf13/cobra"
3736
"k8s.io/cli-runtime/pkg/genericiooptions"
@@ -63,7 +62,7 @@ type configOpsOptions struct {
6362

6463
var (
6564
createReconfigureExample = templates.Examples(`
66-
# update component params
65+
# update component params
6766
kbcli cluster configure mycluster --components=mysql --config-spec=mysql-3node-tpl --config-file=my.cnf --set=max_connections=1000,general_log=OFF
6867
6968
# if only one component, and one config spec, and one config file, simplify the searching process of configure. e.g:
@@ -175,7 +174,7 @@ func (o *configOpsOptions) validateConfigParams(rctx *ReconfigureContext, classi
175174
transform := func(params map[string]*parametersv1alpha1.ParametersInFile) []core.ParamPairs {
176175
var result []core.ParamPairs
177176
for file, ps := range params {
178-
configDescs := intctrlutil.GetComponentConfigDescriptions(&rctx.ConfigRender.Spec, file)
177+
configDescs := controllerutil.GetComponentConfigDescriptions(&rctx.ConfigRender.Spec, file)
179178
builder := configctrl.NewValueManager(rctx.ParametersDefs, configDescs)
180179
updatedParams, _ := core.FromStringMap(ps.Parameters, builder.BuildValueTransformer(file))
181180
result = append(result, core.ParamPairs{

pkg/cmd/kubeblocks/install.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,16 @@ func (o *InstallOptions) waitAddonsEnabled() error {
400400
return nil
401401
}
402402

403+
// if addon list is empty, return nil
404+
objs, err := o.Dynamic.Resource(types.AddonGVR()).List(context.TODO(), metav1.ListOptions{
405+
LabelSelector: buildKubeBlocksSelectorLabels(),
406+
})
407+
408+
if err == nil && (objs == nil || len(objs.Items) == 0) {
409+
klog.V(1).Info("No Addons found")
410+
return nil
411+
}
412+
403413
addons := make(map[string]*extensionsv1alpha1.Addon)
404414
fetchAddons := func() error {
405415
objs, err := o.Dynamic.Resource(types.AddonGVR()).List(context.TODO(), metav1.ListOptions{
@@ -454,7 +464,6 @@ func (o *InstallOptions) waitAddonsEnabled() error {
454464
s := spinner.New(o.Out, spinnerMsg(header))
455465

456466
var (
457-
err error
458467
spinnerDone = func() {
459468
s.SetFinalMsg(msg)
460469
s.Done("")

0 commit comments

Comments
 (0)