Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Limit Restart rate for pd and tikv in admission webhook #1532
Limit Restart rate for pd and tikv in admission webhook #1532
Changes from 7 commits
a37a6f4
b292e32
2b12988
42545dc
86bae56
94287fc
7a9efc1
b02ed57
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
helper.GetPodOrdinals
to get desired ordinals of pods insteadtidb-operator/pkg/manager/member/tidb_member_manager.go
Line 789 in 0bf6259
because the ordinals may not be consecutive with AdvancedStatefulset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can list all pods of the statefulset? In this case, I think it's simpler because we need to get pod objects from the API server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I'm wrong because we need to check the desired pods and return an error if the pod is not created yet, otherwise, pods can be deleted before the previous replica is recreated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that the admission pod webhook only considered the pod controlled by
apps.StatefulSet
for now. Though it would received the deleting request ofadvancedStatefulset
, there are some places still not supportAdvancedStatefulset
yet.tidb-operator/pkg/webhook/pod/util.go
Line 126 in 0bf6259
I think it should be supported in another issue to take it as one whole problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the kind of
AdvancedStatefulset
isStatefulSet
too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only change here is to use
helper.GetPodOrdinals
to get the list of ordinals instead offor loop
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the returned set has a method
List()
to get a sorted slice in asc order, all ordinals<= ordinal
can be ignored in the loopThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if
advancedStatefulSet
is enabled, would the following method inpkg/webhook/pod/util.go
get the owner advancedstatefulset ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will because it does not check the APIGroup (the only different between advanced statefulset with k8s statefulset is the APIGroup)
I'm fine to update later because the admission controller does not support
--features
flag yet.