-
Notifications
You must be signed in to change notification settings - Fork 457
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 handedeletePod repeat 4 times #2789
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
|
oilbeater
approved these changes
May 11, 2023
changluyi
force-pushed
the
fix_handleDeletePod_repeat
branch
from
May 11, 2023 08:48
1094f74
to
7afc452
Compare
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What type of this PR
Examples of user facing changes:
Which issue(s) this PR fixes:
Fixes #2555
做了两个调整:
维护deletingPodObjMap map来作为删除pod的对象映射。在handleDeletePod 后触发一个5min 协程来释放deletingPodObjMap 对应的pod
但是workqueue的去重功能触发时间非常短,因为进入队列后,一旦deletePodQueue.Get()被调用到, workqueue就会把对象从dirty(表示进入队列还未处理)转到processing,再次进来的对象就算是一样,但workqueue也不会去重。
加了这个改动后,基本上能减少一次handle处理。
下面的 newPod.DeletionTimestamp != nil 触发 enqueue deletePodQueue 感觉逻辑上重叠,应该只需要一次触发就够了。
WHAT
🤖 Generated by Copilot at 2b6387a
This pull request enhances the pod controller to track and handle pod deletion more reliably. It adds a new feature to the controller to store pod objects that are being deleted in a map and uses the pod status phase to check for deletion. It also updates the pod controller to use the pod objects from the map instead of the cache. It modifies the files
pkg/controller/controller.go
andpkg/controller/pod.go
.🤖 Generated by Copilot at 2b6387a
HOW
🤖 Generated by Copilot at 2b6387a
k8s.io/api/core/v1
package ask8sv1
to use thePod
type (link)deletingPodObjMap
to theController
type to store the pod objects that are being deleted (link)deletingPodObjMap
field with an empty map in theRun
method of theController
(link)isPodAlive
function into two functions:isPodAlive
andisPodStatusPhaseAlive
to check the pod deletion based on different criteria (link)isPodStatusPhaseAlive
function instead of theisPodAlive
function to check the pod deletion in theenqueueUpdatePod
function (link)deletingPodObjMap
and enqueue the pod key instead of the pod object in thedeletePodQueue
in the following functions:enqueueAddPod
(link),enqueueDeletePod
(link),enqueueUpdatePod
(link, link, link),reconcileAllocateSubnets
(link), andreconcileRouteSubnets
(link) (link)deletingPodObjMap
instead of thedeletePodQueue
in theprocessNextDeletePodWorkItem
function (link)handleDeletePod
function from the pod object to the pod key and get the pod object from thedeletingPodObjMap
(link)