Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <[email protected]>
  • Loading branch information
HuSharp committed Mar 5, 2024
1 parent bdb72f8 commit e46bdee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/manager/member/pd_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func (m *pdMemberManager) Sync(tc *v1alpha1.TidbCluster) error {
return nil
}

if tc.Spec.PD.Mode == "ms" && tc.Spec.PDMS == nil ||
tc.Spec.PDMS != nil && tc.Spec.PD.Mode != "ms" {
if (tc.Spec.PD.Mode == "ms" && tc.Spec.PDMS == nil) ||
(tc.Spec.PDMS != nil && tc.Spec.PD.Mode != "ms") {
klog.Infof("tidbcluster: [%s/%s]'s enable micro service failed, please check `PD.Mode` and `PDMS`", tc.GetNamespace(), tc.GetName())
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/member/tikv_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (m *tikvMemberManager) Sync(tc *v1alpha1.TidbCluster) error {
return controller.RequeueErrorf("TidbCluster: [%s/%s], waiting for PD cluster running", ns, tcName)
}
// Check if all PD Micro Services are available
if tc.Spec.PDMS != nil && tc.Spec.PD != nil && tc.Spec.PD.Mode == "ms" {
if tc.Spec.PDMS != nil && (tc.Spec.PD != nil && tc.Spec.PD.Mode == "ms") {
for _, pdms := range tc.Spec.PDMS {
_, err = controller.GetPDMSClient(m.deps.PDControl, tc, pdms.Name)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions tests/pkg/fixture/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
tcconfig "github.com/pingcap/tidb-operator/pkg/apis/util/config"
"github.com/pingcap/tidb-operator/pkg/controller"
utilimage "github.com/pingcap/tidb-operator/tests/e2e/util/image"
"github.com/pingcap/tidb-operator/tests/third_party/k8s/log"
)

var (
Expand Down Expand Up @@ -194,6 +195,7 @@ func GetTidbCluster(ns, name, version string) *v1alpha1.TidbCluster {

random := rand.Intn(2)
if random != 0 && version == utilimage.PDMSImage {
log.Logf("[GetTidbCluster] tidbcluster's pd mode is micro-service in this situation, version: %s", version)
// 50% random in pdms mode
tc = AddPDMSForTidbCluster(tc)
}
Expand Down

0 comments on commit e46bdee

Please sign in to comment.