Skip to content

Commit 3dc6d64

Browse files
committed
Skip remanage pods being deleted
Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
1 parent dd27f48 commit 3dc6d64

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/controller/manage/manage_controller.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ func (c *KmeshManageController) handlePodAdd(obj interface{}) {
160160
}
161161

162162
func (c *KmeshManageController) handlePodUpdate(_, newObj interface{}) {
163+
pod, ok := newObj.(*corev1.Pod)
164+
if !ok {
165+
log.Errorf("expected *corev1.Pod but got %T", newObj)
166+
return
167+
}
168+
if pod.DeletionTimestamp != nil {
169+
log.Debugf("pod %s/%s is being deleted, skip remanage", pod.Namespace, pod.Name)
170+
return
171+
}
163172
c.handlePodAdd(newObj)
164173
}
165174

@@ -229,7 +238,7 @@ func (c *KmeshManageController) enableKmeshManage(pod *corev1.Pod) {
229238
log.Debugf("Pod %s/%s is not ready, skipping Kmesh manage enable", pod.GetNamespace(), pod.GetName())
230239
return
231240
}
232-
log.Infof("%s/%s: enable Kmesh manage", pod.GetNamespace(), pod.GetName())
241+
log.Debugf("%s/%s: enable Kmesh manage", pod.GetNamespace(), pod.GetName())
233242
nspath, _ := ns.GetPodNSpath(pod)
234243
if err := utils.HandleKmeshManage(nspath, true); err != nil {
235244
log.Errorf("failed to enable Kmesh manage")

0 commit comments

Comments
 (0)