-
Notifications
You must be signed in to change notification settings - Fork 1k
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 PodGroup being incorrectly deleted due to frequent creation and deletion of pods #3375
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1027,9 +1027,20 @@ func (sc *SchedulerCache) processCleanupJob() { | |
defer sc.Mutex.Unlock() | ||
|
||
if schedulingapi.JobTerminated(job) { | ||
delete(sc.Jobs, job.UID) | ||
metrics.DeleteJobMetrics(job.Name, string(job.Queue), job.Namespace) | ||
klog.V(3).Infof("Job <%v:%v/%v> was deleted.", job.UID, job.Namespace, job.Name) | ||
oldJob, found := sc.Jobs[job.UID] | ||
if !found { | ||
klog.V(3).Infof("Failed to find Job <%v:%v/%v>, ignore it", job.UID, job.Namespace, job.Name) | ||
sc.DeletedJobs.Forget(obj) | ||
return | ||
} | ||
newPgVersion := oldJob.PgUID | ||
oldPgVersion := job.PgUID | ||
klog.V(5).Infof("Just add pguid:%v, try to delete pguid:%v", newPgVersion, oldPgVersion) | ||
if oldPgVersion == newPgVersion { | ||
delete(sc.Jobs, job.UID) | ||
metrics.DeleteJobMetrics(job.Name, string(job.Queue), job.Namespace) | ||
klog.V(3).Infof("Job <%v:%v/%v> was deleted.", job.UID, job.Namespace, job.Name) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If oldPgVersion is not equal to newPgVersion, the current obj should also be discarded. Otherwise, DeletedJobs will be retried infinitely. In addition, DeletedJobs may be full after a long time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forget and Done method can guarantee old key be discarded. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
sc.DeletedJobs.Forget(obj) | ||
} else { | ||
// Retry | ||
|
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.
Should obj be discarded here to avoid infinite retries?
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.
done