Skip to content

Commit

Permalink
fix PD peer svc update repeatly (#5015)
Browse files Browse the repository at this point in the history
  • Loading branch information
csuzhangxc authored May 23, 2023
1 parent 8550aa2 commit eaae778
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/manager/member/pd_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (m *pdMemberManager) syncPDHeadlessServiceForTidbCluster(tc *v1alpha1.TidbC
tcName := tc.GetName()

newSvc := getNewPDHeadlessServiceForTidbCluster(tc)
oldSvc, err := m.deps.ServiceLister.Services(ns).Get(controller.PDPeerMemberName(tcName))
oldSvcTmp, err := m.deps.ServiceLister.Services(ns).Get(controller.PDPeerMemberName(tcName))
if errors.IsNotFound(err) {
err = controller.SetServiceLastAppliedConfigAnnotation(newSvc)
if err != nil {
Expand All @@ -164,6 +164,8 @@ func (m *pdMemberManager) syncPDHeadlessServiceForTidbCluster(tc *v1alpha1.TidbC
return fmt.Errorf("syncPDHeadlessServiceForTidbCluster: failed to get svc %s for cluster %s/%s, error: %s", controller.PDPeerMemberName(tcName), ns, tcName, err)
}

oldSvc := oldSvcTmp.DeepCopy()

_, err = m.deps.ServiceControl.SyncComponentService(
tc,
newSvc,
Expand Down

0 comments on commit eaae778

Please sign in to comment.