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

Fix sts webhook error #2291

Merged
merged 9 commits into from
Apr 26, 2020
Merged

Fix sts webhook error #2291

merged 9 commits into from
Apr 26, 2020

Conversation

Yisaer
Copy link
Contributor

@Yisaer Yisaer commented Apr 25, 2020

What problem does this PR solve?

Fix the error which would cause panic for sts webhook when sts updated strategy is not rolling updated.

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Does this PR introduce a user-facing change?:

Fix a bug which would cause panic in statefulset webhook when update strategy of `StatefulSet` is not `RollingUpdate`

@Yisaer Yisaer added the type/bug Something isn't working label Apr 25, 2020
klog.Infof("statefulset %s/%s has been protect by partition %s annotations", namespace, name, partitionStr)
return util.ARFail(errors.New("protect by partition annotation"))
}
klog.Infof("admit statefulset %s/%s update partition to %d, protect partition is %d", namespace, name, setPartition, partition)
klog.Infof("admit statefulset %s/%s update partition to %d, protect partition is %d", namespace, name, *stsPartition, partition)
Copy link
Contributor

Choose a reason for hiding this comment

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

stsPartition is possible to be nil here.

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

if set.Spec.UpdateStrategy.RollingUpdate != nil {
return &(set.ObjectMeta), set.Spec.UpdateStrategy.RollingUpdate.Partition, nil
}
return &(set.ObjectMeta), nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

the code seems identical no matter what apiVersion is?

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.

@cofyc
Copy link
Contributor

cofyc commented Apr 26, 2020

Suggested release note:

Fix a bug which would cause panic in statefulset webhook when update strategy of `StatefulSet` is not `RollingUpdate`

https://github.com/pingcap/tidb-operator/blob/master/docs/release-note-guide.md

Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

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

LGTM

@Yisaer
Copy link
Contributor Author

Yisaer commented Apr 26, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Apr 26, 2020

/run-all-tests

@sre-bot sre-bot merged commit 31c26c4 into pingcap:master Apr 26, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Apr 26, 2020

cherry pick to release-1.1 in PR #2306

Yisaer pushed a commit that referenced this pull request Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants