Skip to content

Commit

Permalink
Fix defaulting bug (#1845) (#1847)
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot committed Mar 3, 2020
1 parent fe41b7a commit 9e0ace9
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions pkg/apis/pingcap/v1alpha1/defaulting/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,39 @@ func setTidbSpecDefault(tc *v1alpha1.TidbCluster) {
if tc.Spec.TiDB.BaseImage == "" {
tc.Spec.TiDB.BaseImage = defaultTiDBImage
}
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.Config == nil {
tc.Spec.TiDB.Config = &v1alpha1.TiDBConfig{}
}
}
}

func setTikvSpecDefault(tc *v1alpha1.TidbCluster) {
if tc.Spec.TiKV.Config == nil {
tc.Spec.TiKV.Config = &v1alpha1.TiKVConfig{}
}
if tc.Spec.TiKV.BaseImage == "" {
tc.Spec.TiKV.BaseImage = defaultTiKVImage
if len(tc.Spec.Version) > 0 || tc.Spec.TiKV.Version != nil {
if tc.Spec.TiKV.BaseImage == "" {
tc.Spec.TiKV.BaseImage = defaultTiKVImage
}
}
}

func setPdSpecDefault(tc *v1alpha1.TidbCluster) {
if tc.Spec.PD.Config == nil {
tc.Spec.PD.Config = &v1alpha1.PDConfig{}
}
if tc.Spec.PD.BaseImage == "" {
tc.Spec.PD.BaseImage = defaultPDImage
if len(tc.Spec.Version) > 0 || tc.Spec.PD.Version != nil {
if tc.Spec.PD.BaseImage == "" {
tc.Spec.PD.BaseImage = defaultPDImage
}
}
}

func setPumpSpecDefault(tc *v1alpha1.TidbCluster) {
if tc.Spec.Pump.BaseImage == "" {
tc.Spec.Pump.BaseImage = defaultBinlogImage
if len(tc.Spec.Version) > 0 || tc.Spec.Pump.Version != nil {
if tc.Spec.Pump.BaseImage == "" {
tc.Spec.Pump.BaseImage = defaultBinlogImage
}
}
}

0 comments on commit 9e0ace9

Please sign in to comment.