bugfix add a new shadowjob when delete pod

This commit is contained in:
Your Name 2019-12-11 14:44:01 +08:00
parent 1b5a1b1b7e
commit 27be1730f0
1 changed files with 4 additions and 0 deletions

View File

@ -116,6 +116,10 @@ func (sc *SchedulerCache) updatePod(oldPod, newPod *v1.Pod) error {
if err := sc.deletePod(oldPod); err != nil {
return err
}
//when delete pod, the ownerreference of pod will be set nil,just as orphan pod
if len(utils.GetController(newPod)) == 0 {
newPod.OwnerReferences = oldPod.OwnerReferences
}
return sc.addPod(newPod)
}