Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielZhangQD committed Apr 28, 2020
1 parent 223c3aa commit 117864e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/manager/member/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func GetLastAppliedConfig(set *apps.StatefulSet) (*apps.StatefulSetSpec, *corev1
// statefulSetEqual compares the new Statefulset's spec with old Statefulset's last applied config
func statefulSetEqual(new apps.StatefulSet, old apps.StatefulSet) bool {
// The annotations in old sts may include LastAppliedConfigAnnotation
var tmpAnno map[string]string
tmpAnno := map[string]string{}
for k, v := range old.Annotations {
if k != LastAppliedConfigAnnotation {
tmpAnno[k] = v
Expand All @@ -120,11 +120,7 @@ func statefulSetEqual(new apps.StatefulSet, old apps.StatefulSet) bool {
// oldConfig.Template.Annotations may include LastAppliedConfigAnnotation to keep backward compatiability
// Please check detail in https://github.com/pingcap/tidb-operator/pull/1489
tmpTemplate := oldConfig.Template.DeepCopy()
if tmpTemplate.Annotations != nil {
if _, ok := tmpTemplate.Annotations[LastAppliedConfigAnnotation]; ok {
delete(tmpTemplate.Annotations, LastAppliedConfigAnnotation)
}
}
delete(tmpTemplate.Annotations, LastAppliedConfigAnnotation)
return apiequality.Semantic.DeepEqual(oldConfig.Replicas, new.Spec.Replicas) &&
apiequality.Semantic.DeepEqual(*tmpTemplate, new.Spec.Template) &&
apiequality.Semantic.DeepEqual(oldConfig.UpdateStrategy, new.Spec.UpdateStrategy)
Expand Down

0 comments on commit 117864e

Please sign in to comment.