From 27be1730f08b1a17919775352420e081fa6e2e68 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 11 Dec 2019 14:44:01 +0800 Subject: [PATCH] bugfix add a new shadowjob when delete pod --- pkg/scheduler/cache/event_handlers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/scheduler/cache/event_handlers.go b/pkg/scheduler/cache/event_handlers.go index dfe0c62f91..55e4b5c8ca 100644 --- a/pkg/scheduler/cache/event_handlers.go +++ b/pkg/scheduler/cache/event_handlers.go @@ -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) }