diff --git a/pkg/apis/pingcap/v1alpha1/defaulting/tidbcluster.go b/pkg/apis/pingcap/v1alpha1/defaulting/tidbcluster.go index a3ce0d68522..2c2fa69f38e 100644 --- a/pkg/apis/pingcap/v1alpha1/defaulting/tidbcluster.go +++ b/pkg/apis/pingcap/v1alpha1/defaulting/tidbcluster.go @@ -51,9 +51,6 @@ func setTidbClusterSpecDefault(tc *v1alpha1.TidbCluster) { } func setTidbSpecDefault(tc *v1alpha1.TidbCluster) { - if tc.Spec.TiDB.Config == nil { - tc.Spec.TiDB.Config = &v1alpha1.TiDBConfig{} - } if len(tc.Spec.Version) > 0 || tc.Spec.TiDB.Version != nil { if tc.Spec.TiDB.BaseImage == "" { tc.Spec.TiDB.BaseImage = defaultTiDBImage @@ -62,9 +59,6 @@ func setTidbSpecDefault(tc *v1alpha1.TidbCluster) { } func setTikvSpecDefault(tc *v1alpha1.TidbCluster) { - if tc.Spec.TiKV.Config == nil { - tc.Spec.TiKV.Config = &v1alpha1.TiKVConfig{} - } if len(tc.Spec.Version) > 0 || tc.Spec.TiKV.Version != nil { if tc.Spec.TiKV.BaseImage == "" { tc.Spec.TiKV.BaseImage = defaultTiKVImage @@ -73,9 +67,6 @@ func setTikvSpecDefault(tc *v1alpha1.TidbCluster) { } func setPdSpecDefault(tc *v1alpha1.TidbCluster) { - if tc.Spec.PD.Config == nil { - tc.Spec.PD.Config = &v1alpha1.PDConfig{} - } if len(tc.Spec.Version) > 0 || tc.Spec.PD.Version != nil { if tc.Spec.PD.BaseImage == "" { tc.Spec.PD.BaseImage = defaultPDImage diff --git a/pkg/apis/pingcap/v1alpha1/validation/validation.go b/pkg/apis/pingcap/v1alpha1/validation/validation.go index 728f6b80fcb..39855db7a20 100644 --- a/pkg/apis/pingcap/v1alpha1/validation/validation.go +++ b/pkg/apis/pingcap/v1alpha1/validation/validation.go @@ -88,15 +88,6 @@ func validateNewTidbClusterSpec(spec *v1alpha1.TidbClusterSpec, path *field.Path if spec.PD.Image != "" { allErrs = append(allErrs, field.Invalid(path.Child("pd.image"), spec.PD.Image, "image has been deprecated, use baseImage instead")) } - if spec.TiDB.Config == nil { - allErrs = append(allErrs, field.Invalid(path.Child("tidb.config"), spec.TiDB.Config, "tidb.config must not be nil")) - } - if spec.TiKV.Config == nil { - allErrs = append(allErrs, field.Invalid(path.Child("tikv.config"), spec.TiKV.Config, "tidb.config must not be nil")) - } - if spec.PD.Config == nil { - allErrs = append(allErrs, field.Invalid(path.Child("pd.config"), spec.PD.Config, "tidb.config must not be nil")) - } return allErrs } diff --git a/tests/e2e/tidbcluster/serial.go b/tests/e2e/tidbcluster/serial.go index 58619678dbb..74c9a6da183 100644 --- a/tests/e2e/tidbcluster/serial.go +++ b/tests/e2e/tidbcluster/serial.go @@ -590,9 +590,6 @@ var _ = ginkgo.Describe("[tidb-operator][Serial]", func() { if empty, err := gomega.BeEmpty().Match(newTC.Spec.TiDB.BaseImage); empty { e2elog.Failf("Expected tidb.baseImage has default value set, %v", err) } - if isNil, err := gomega.BeNil().Match(newTC.Spec.TiDB.Config); isNil { - e2elog.Failf("Expected tidb.config has default value set, %v", err) - } ginkgo.By("Validating should reject illegal update") newTC.Labels = map[string]string{ @@ -601,8 +598,10 @@ var _ = ginkgo.Describe("[tidb-operator][Serial]", func() { _, err = cli.PingcapV1alpha1().TidbClusters(ns).Update(newTC) framework.ExpectError(err, "Could not set instance label with value other than cluster name") - newTC.Spec.PD.Config.Replication = &v1alpha1.PDReplicationConfig{ - MaxReplicas: func() *uint64 { i := uint64(5); return &i }(), + newTC.Spec.PD.Config = &v1alpha1.PDConfig{ + Replication: &v1alpha1.PDReplicationConfig{ + MaxReplicas: func() *uint64 { i := uint64(5); return &i }(), + }, } _, err = cli.PingcapV1alpha1().TidbClusters(ns).Update(newTC) framework.ExpectError(err, "PD replication config is immutable through CR")