Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statefulsets are updated during each sync even if no changes to the config #2308

Merged
merged 3 commits into from
Apr 28, 2020

Conversation

DanielZhangQD
Copy link
Contributor

What problem does this PR solve?

statefulsets are updated during each sync even if no changes to the config

What is changed and how does it work?

Fix the equality check logic

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    • Check tidb-controller-manager logs that statefulsets are not updated without changes to the config

Code changes

  • Has Go code change

Related changes

  • Need to cherry-pick to the release branch

Does this PR introduce a user-facing change?:

Fix the issue that statefulsets are updated during each sync even if no changes to the config

Yisaer
Yisaer previously approved these changes Apr 27, 2020
weekface
weekface previously approved these changes Apr 27, 2020
@DanielZhangQD
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

1 similar comment
@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

@DanielZhangQD merge failed.

@DanielZhangQD
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

@DanielZhangQD merge failed.

@DanielZhangQD
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

@DanielZhangQD merge failed.

@DanielZhangQD
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@cofyc
Copy link
Contributor

cofyc commented Apr 27, 2020

github actions failed, it's not possible to merge this PR. github actions jobs must be re-run manually:

image

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

@DanielZhangQD merge failed.

@DanielZhangQD
Copy link
Contributor Author

github actions failed, it's not possible to merge this PR. github actions jobs must be re-run manually:

OK, Thanks!

@DanielZhangQD
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

1 similar comment
@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

@DanielZhangQD merge failed.

@DanielZhangQD
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Apr 27, 2020

@DanielZhangQD merge failed.

@Yisaer
Copy link
Contributor

Yisaer commented Apr 28, 2020

/run-e2e-in-kind

@@ -100,7 +100,14 @@ 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 {
if !apiequality.Semantic.DeepEqual(new.Annotations, old.Annotations) {
// The annotations in old sts may include LastAppliedConfigAnnotation
var tmpAnno map[string]string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var tmpAnno map[string]string
tmpAnno := make(map[string]string)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix panic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! Fixed.

Comment on lines 124 to 126
if _, ok := tmpTemplate.Annotations[LastAppliedConfigAnnotation]; ok {
delete(tmpTemplate.Annotations, LastAppliedConfigAnnotation)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if _, ok := tmpTemplate.Annotations[LastAppliedConfigAnnotation]; ok {
delete(tmpTemplate.Annotations, LastAppliedConfigAnnotation)
}
delete(tmpTemplate.Annotations, LastAppliedConfigAnnotation)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more concise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@sre-bot
Copy link
Contributor

sre-bot commented Apr 28, 2020

cherry pick to release-1.1 in PR #2325

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants