Skip to content

Commit bf14291

Browse files
authored
Merge pull request #394 from runkecheng/feature_uniform_role_label
syncer: Uniform use of global variables set role labels.
2 parents cac9035 + a3e7ffa commit bf14291

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mysqlcluster/syncer/statefulset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func (s *StatefulSetSyncer) updatePod(ctx context.Context) error {
323323
return fmt.Errorf("can't start/continue 'update': pod[%s] is unhealthy", pod.Name)
324324
}
325325
// Skip if pod is leader.
326-
if pod.ObjectMeta.Labels["role"] == "leader" && leaderPod.Name == "" {
326+
if pod.ObjectMeta.Labels["role"] == string(utils.Leader) && leaderPod.Name == "" {
327327
leaderPod = pod
328328
continue
329329
}
@@ -355,7 +355,7 @@ func (s *StatefulSetSyncer) mutate() error {
355355
for k, v := range s.Spec.PodPolicy.Labels {
356356
s.sfs.Spec.Template.ObjectMeta.Labels[k] = v
357357
}
358-
s.sfs.Spec.Template.ObjectMeta.Labels["role"] = "candidate"
358+
s.sfs.Spec.Template.ObjectMeta.Labels["role"] = string(utils.Candidate)
359359
s.sfs.Spec.Template.ObjectMeta.Labels["healthy"] = "no"
360360

361361
s.sfs.Spec.Template.Annotations = s.Spec.PodPolicy.Annotations

0 commit comments

Comments
 (0)