This commit is contained in:
feyoung 2025-06-21 09:58:28 +08:00 committed by GitHub
commit d4095e53ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 21 deletions

View File

@ -68,9 +68,7 @@ func (cc *jobcontroller) addJob(obj interface{}) {
klog.Errorf("Failed to add job <%s/%s>: %v in cache",
job.Namespace, job.Name, err)
}
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
cc.addJobInQueue(req)
}
func (cc *jobcontroller) updateJob(oldObj, newObj interface{}) {
@ -109,9 +107,7 @@ func (cc *jobcontroller) updateJob(oldObj, newObj interface{}) {
JobName: newJob.Name,
Event: bus.OutOfSyncEvent,
}
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
cc.addJobInQueue(req)
}
func (cc *jobcontroller) deleteJob(obj interface{}) {
@ -195,9 +191,7 @@ func (cc *jobcontroller) addPod(obj interface{}) {
klog.Errorf("Failed to add Pod <%s/%s>: %v to cache",
pod.Namespace, pod.Name, err)
}
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
cc.addJobInQueue(req)
}
func (cc *jobcontroller) updatePod(oldObj, newObj interface{}) {
@ -310,9 +304,7 @@ func (cc *jobcontroller) updatePod(oldObj, newObj interface{}) {
JobVersion: int32(dVersion),
}
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
cc.addJobInQueue(req)
}
func (cc *jobcontroller) deletePod(obj interface{}) {
@ -384,9 +376,7 @@ func (cc *jobcontroller) deletePod(obj interface{}) {
pod.Namespace, pod.Name, err)
}
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
cc.addJobInQueue(req)
}
func (cc *jobcontroller) recordJobEvent(namespace, name string, event batch.JobEvent, message string) {
@ -430,9 +420,7 @@ func (cc *jobcontroller) processNextCommand() bool {
Action: bus.Action(cmd.Action),
}
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
cc.addJobInQueue(req)
return true
}
@ -473,10 +461,14 @@ func (cc *jobcontroller) updatePodGroup(oldObj, newObj interface{}) {
case scheduling.PodGroupUnknown:
req.Event = bus.JobUnknownEvent
}
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
cc.addJobInQueue(req)
}
}
func (cc *jobcontroller) addJobInQueue(req apis.Request) {
key := jobhelpers.GetJobKeyByReq(&req)
queue := cc.getWorkerQueue(key)
queue.Add(req)
}
// TODO(k82cn): add handler for PodGroup unschedulable event.