Skip to content

Commit 92b2169

Browse files
committed
chore: bump kubeblocks to v1.1.x (#685)
(cherry picked from commit 25885f7)
1 parent 8c65f1a commit 92b2169

19 files changed

Lines changed: 75 additions & 49 deletions

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/Masterminds/semver/v3 v3.3.0
1111
github.com/NimbleMarkets/ntcharts v0.1.2
1212
github.com/apecloud/dbctl v0.0.0-20240827084000-68a1980b1a46
13-
github.com/apecloud/kubeblocks v1.0.3-beta.8
13+
github.com/apecloud/kubeblocks v1.1.0-beta.5
1414
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
1515
github.com/briandowns/spinner v1.23.0
1616
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20230912020346-a5d89c1c90ad

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,8 @@ github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4x
695695
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
696696
github.com/apecloud/dbctl v0.0.0-20240827084000-68a1980b1a46 h1:+Jcc7IjDGxPgIfIkGX2Q5Yxj35U65zgcfjh0B9rDhjo=
697697
github.com/apecloud/dbctl v0.0.0-20240827084000-68a1980b1a46/go.mod h1:eksJtZ7z1nVcVLqDzAdcN5EfpHwXllIAvHZEks2zWys=
698-
github.com/apecloud/kubeblocks v1.0.3-beta.8 h1:9HPgzrLg537dof599VyNRX/gjEFK9Kb819ofDJxz9c0=
699-
github.com/apecloud/kubeblocks v1.0.3-beta.8/go.mod h1:lB4LCrNPjHlgkDrBr1jTFVepwGUEU6wjZ7jMeCpM0V4=
698+
github.com/apecloud/kubeblocks v1.1.0-beta.5 h1:a3Jng19OOquH12SqqEBi/pd6fMAeD01NCInLZe9nTP4=
699+
github.com/apecloud/kubeblocks v1.1.0-beta.5/go.mod h1:vx9p2tv5x4NZiShUvl1MXVl9RO343Bu1nCpbAKdcA6k=
700700
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
701701
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
702702
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=

pkg/cluster/cluster.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func (o *ClusterObjects) GetComponentInfo() []*ComponentInfo {
310310
var comps []*ComponentInfo
311311
setComponentInfos := func(compSpec kbappsv1.ClusterComponentSpec,
312312
resources corev1.ResourceRequirements,
313-
storages []kbappsv1.ClusterComponentVolumeClaimTemplate,
313+
storages []kbappsv1.PersistentVolumeClaimTemplate,
314314
replicas int32,
315315
clusterCompName string,
316316
templateName string,
@@ -514,12 +514,12 @@ func (o *ClusterObjects) getPodPhase(pod *corev1.Pod) string {
514514
return reason
515515
}
516516

517-
func (o *ClusterObjects) getStorageInfo(vcts []kbappsv1.ClusterComponentVolumeClaimTemplate, componentName string) []StorageInfo {
517+
func (o *ClusterObjects) getStorageInfo(vcts []kbappsv1.PersistentVolumeClaimTemplate, componentName string) []StorageInfo {
518518
if len(vcts) == 0 {
519519
return nil
520520
}
521521

522-
getClassName := func(vcTpl *kbappsv1.ClusterComponentVolumeClaimTemplate) string {
522+
getClassName := func(vcTpl *kbappsv1.PersistentVolumeClaimTemplate) string {
523523
if vcTpl.Spec.StorageClassName != nil {
524524
return *vcTpl.Spec.StorageClassName
525525
}

pkg/cluster/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func getInstanceInfoByList(dynamic dynamic.Interface, name, componentName, names
8181
if ok {
8282
info.Role = role
8383
}
84-
if role == constant.Primary || role == constant.Leader {
84+
if role == "primary" || role == "leader" {
8585
infos = append([]*InstanceInfo{info}, infos...)
8686
} else {
8787
infos = append(infos, info)

pkg/cmd/cluster/config_edit.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import (
2828

2929
opsv1alpha1 "github.com/apecloud/kubeblocks/apis/operations/v1alpha1"
3030
parametersv1alpha1 "github.com/apecloud/kubeblocks/apis/parameters/v1alpha1"
31-
cfgcm "github.com/apecloud/kubeblocks/pkg/configuration/config_manager"
32-
"github.com/apecloud/kubeblocks/pkg/configuration/core"
33-
"github.com/apecloud/kubeblocks/pkg/configuration/validate"
34-
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
31+
configctrl "github.com/apecloud/kubeblocks/pkg/parameters"
32+
cfgcm "github.com/apecloud/kubeblocks/pkg/parameters/configmanager"
33+
"github.com/apecloud/kubeblocks/pkg/parameters/core"
34+
"github.com/apecloud/kubeblocks/pkg/parameters/validate"
3535
"github.com/spf13/cobra"
3636
"golang.org/x/exp/slices"
3737
"k8s.io/apimachinery/pkg/util/sets"
@@ -111,7 +111,7 @@ func hasSchemaForFile(rctx *ReconfigureContext, configFile string) bool {
111111
if rctx.ConfigRender == nil {
112112
return false
113113
}
114-
return intctrlutil.GetComponentConfigDescription(&rctx.ConfigRender.Spec, configFile) != nil
114+
return configctrl.GetComponentConfigDescription(&rctx.ConfigRender.Spec, configFile) != nil
115115
}
116116

117117
func (o *editConfigOptions) runWithConfigConstraints(cfgEditContext *configEditContext, rctx *ReconfigureContext, fn func() error) error {
@@ -146,7 +146,7 @@ func (o *editConfigOptions) runWithConfigConstraints(cfgEditContext *configEditC
146146
}
147147

148148
var config *parametersv1alpha1.ComponentConfigDescription
149-
if config = intctrlutil.GetComponentConfigDescription(&rctx.ConfigRender.Spec, o.CfgFile); config == nil {
149+
if config = configctrl.GetComponentConfigDescription(&rctx.ConfigRender.Spec, o.CfgFile); config == nil {
150150
return fn()
151151
}
152152
var pd *parametersv1alpha1.ParametersDefinition

pkg/cmd/cluster/config_observer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ import (
2323
"fmt"
2424

2525
parametersv1alpha1 "github.com/apecloud/kubeblocks/apis/parameters/v1alpha1"
26-
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
26+
configctrl "github.com/apecloud/kubeblocks/pkg/parameters"
2727
"github.com/spf13/cobra"
2828
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2929
"k8s.io/cli-runtime/pkg/genericiooptions"
3030
cmdutil "k8s.io/kubectl/pkg/cmd/util"
3131
"k8s.io/kubectl/pkg/util/templates"
3232

33-
cfgcore "github.com/apecloud/kubeblocks/pkg/configuration/core"
34-
"github.com/apecloud/kubeblocks/pkg/configuration/openapi"
35-
cfgutil "github.com/apecloud/kubeblocks/pkg/configuration/util"
33+
cfgcore "github.com/apecloud/kubeblocks/pkg/parameters/core"
34+
"github.com/apecloud/kubeblocks/pkg/parameters/openapi"
35+
cfgutil "github.com/apecloud/kubeblocks/pkg/parameters/util"
3636

3737
"github.com/apecloud/kbcli/pkg/printer"
3838
"github.com/apecloud/kbcli/pkg/types"
@@ -140,7 +140,7 @@ func (r *configObserverOptions) printComponentConfigSpecsDescribe(rctx *Reconfig
140140
func (r *configObserverOptions) printComponentExplainConfigure(rctx *ReconfigureContext) error {
141141
for _, pd := range rctx.ParametersDefs {
142142
if rctx.ConfigRender != nil {
143-
config := intctrlutil.GetComponentConfigDescription(&rctx.ConfigRender.Spec, pd.Spec.FileName)
143+
config := configctrl.GetComponentConfigDescription(&rctx.ConfigRender.Spec, pd.Spec.FileName)
144144
if config != nil {
145145
fmt.Println("template meta:")
146146
printer.PrintLineWithTabSeparator(

pkg/cmd/cluster/config_ops.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ import (
2727
opsv1alpha1 "github.com/apecloud/kubeblocks/apis/operations/v1alpha1"
2828
parametersv1alpha1 "github.com/apecloud/kubeblocks/apis/parameters/v1alpha1"
2929
"github.com/apecloud/kubeblocks/pkg/client/clientset/versioned"
30-
cfgcm "github.com/apecloud/kubeblocks/pkg/configuration/config_manager"
31-
"github.com/apecloud/kubeblocks/pkg/configuration/core"
32-
configctrl "github.com/apecloud/kubeblocks/pkg/controller/configuration"
33-
controllerutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
3430
"github.com/apecloud/kubeblocks/pkg/generics"
31+
configctrl "github.com/apecloud/kubeblocks/pkg/parameters"
32+
cfgcm "github.com/apecloud/kubeblocks/pkg/parameters/configmanager"
33+
"github.com/apecloud/kubeblocks/pkg/parameters/core"
3534
"github.com/spf13/cobra"
3635
"k8s.io/cli-runtime/pkg/genericiooptions"
3736
cmdutil "k8s.io/kubectl/pkg/cmd/util"
@@ -115,7 +114,7 @@ func (o *configOpsOptions) validateReconfigureOptions() error {
115114
if err != nil {
116115
return err
117116
}
118-
o.KeyValues = core.FromStringPointerMap(kvs)
117+
o.KeyValues = fromStringPointerMap(kvs)
119118
}
120119
return nil
121120
}
@@ -174,7 +173,7 @@ func (o *configOpsOptions) validateConfigParams(rctx *ReconfigureContext, classi
174173
transform := func(params map[string]*parametersv1alpha1.ParametersInFile) []core.ParamPairs {
175174
var result []core.ParamPairs
176175
for file, ps := range params {
177-
configDescs := controllerutil.GetComponentConfigDescriptions(&rctx.ConfigRender.Spec, file)
176+
configDescs := configctrl.GetComponentConfigDescriptions(&rctx.ConfigRender.Spec, file)
178177
builder := configctrl.NewValueManager(rctx.ParametersDefs, configDescs)
179178
updatedParams, _ := core.FromStringMap(ps.Parameters, builder.BuildValueTransformer(file))
180179
result = append(result, core.ParamPairs{
@@ -187,7 +186,7 @@ func (o *configOpsOptions) validateConfigParams(rctx *ReconfigureContext, classi
187186

188187
restart := false
189188
for _, parameters := range classifyParameters {
190-
_, err := controllerutil.MergeAndValidateConfigs(mockEmptyData(parameters), transform(parameters), rctx.ParametersDefs, rctx.ConfigRender.Spec.Configs)
189+
_, err := configctrl.MergeAndValidateConfigs(mockEmptyData(parameters), transform(parameters), rctx.ParametersDefs, rctx.ConfigRender.Spec.Configs)
191190
if err != nil {
192191
return err
193192
}
@@ -210,6 +209,15 @@ func mockEmptyData(m map[string]*parametersv1alpha1.ParametersInFile) map[string
210209
return r
211210
}
212211

212+
func fromStringPointerMap(m map[string]string) map[string]*string {
213+
r := make(map[string]*string, len(m))
214+
for key, value := range m {
215+
v := value
216+
r[key] = &v
217+
}
218+
return r
219+
}
220+
213221
func (o *configOpsOptions) confirmReconfigureWithRestart() error {
214222
if o.AutoApprove {
215223
return nil

pkg/cmd/cluster/config_ops_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434

3535
kbappsv1 "github.com/apecloud/kubeblocks/apis/apps/v1"
3636
kbfakeclient "github.com/apecloud/kubeblocks/pkg/client/clientset/versioned/fake"
37-
cfgcore "github.com/apecloud/kubeblocks/pkg/configuration/core"
37+
cfgcore "github.com/apecloud/kubeblocks/pkg/parameters/core"
3838
testapps "github.com/apecloud/kubeblocks/pkg/testutil/apps"
3939

4040
"github.com/apecloud/kbcli/pkg/testing"
@@ -79,7 +79,7 @@ var _ = Describe("reconfigure test", func() {
7979

8080
By("Create configmap and config constraint obj")
8181
configmap := testapps.NewCustomizedObj("resources/mysql-config-template.yaml", &corev1.ConfigMap{}, testapps.WithNamespace(ns), testapps.WithName(testing.FakeMysqlTemplateName))
82-
componentConfig := testapps.NewConfigMap(ns, cfgcore.GetComponentCfgName(clusterName, statefulCompName, configSpecName), testapps.SetConfigMapData("my.cnf", ""))
82+
componentConfig := testapps.NewConfigMap(ns, cfgcore.GetComponentCfgName(clusterName, statefulCompName, configSpecName), setConfigMapData("my.cnf", ""))
8383
objs := []runtime.Object{configmap, componentConfig}
8484
ttf, ops := NewFakeOperationsOptions(ns, clusterName, objs...)
8585
o := &configOpsOptions{
@@ -121,3 +121,9 @@ var _ = Describe("reconfigure test", func() {
121121
})
122122

123123
})
124+
125+
func setConfigMapData(key string, value string) func(*corev1.ConfigMap) {
126+
return func(cm *corev1.ConfigMap) {
127+
cm.Data[key] = value
128+
}
129+
}

pkg/cmd/cluster/config_util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import (
3838
"k8s.io/kubectl/pkg/cmd/util/editor"
3939
"sigs.k8s.io/controller-runtime/pkg/client"
4040

41-
cfgcore "github.com/apecloud/kubeblocks/pkg/configuration/core"
42-
cfgutil "github.com/apecloud/kubeblocks/pkg/configuration/util"
41+
cfgcore "github.com/apecloud/kubeblocks/pkg/parameters/core"
42+
cfgutil "github.com/apecloud/kubeblocks/pkg/parameters/util"
4343

4444
"github.com/apecloud/kbcli/pkg/action"
4545
"github.com/apecloud/kbcli/pkg/printer"

pkg/cmd/cluster/config_wrapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
kbappsv1 "github.com/apecloud/kubeblocks/apis/apps/v1"
2828
parametersv1alpha1 "github.com/apecloud/kubeblocks/apis/parameters/v1alpha1"
2929
"github.com/apecloud/kubeblocks/pkg/client/clientset/versioned"
30-
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
3130
"github.com/apecloud/kubeblocks/pkg/generics"
31+
configctrl "github.com/apecloud/kubeblocks/pkg/parameters"
3232
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333
cmdutil "k8s.io/kubectl/pkg/cmd/util"
3434
)
@@ -61,7 +61,7 @@ func (w *ReconfigureWrapper) ConfigSpecName() string {
6161
}
6262
file := w.ConfigFile()
6363
if file != "" && w.rctx.ConfigRender != nil {
64-
config := intctrlutil.GetComponentConfigDescription(&w.rctx.ConfigRender.Spec, file)
64+
config := configctrl.GetComponentConfigDescription(&w.rctx.ConfigRender.Spec, file)
6565
if config != nil {
6666
return config.TemplateName
6767
}

0 commit comments

Comments
 (0)