k8s v1.19.0
强删Pod产生Update事件
informerFactory.Core().V1().Pods().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
UpdateFunc: func(old, new interface{}) {
newPod, ok := new.(*core_v1.Pod)
if ok && newPod.DeletionTimestamp != nil {
klog.Infof("pod %s/%s is deleting", newPod.Namespace, newPod.Name)
}
},
})
kube-apiserver流程分析
staging/src/k8s.io/apiserver/pkg/registry/rest/delete.go
BeforeDelete函数返回graceful是true
staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go
更新发生在删除Pod之前。
标签:强删,update,apiserver,registry,pod,k8s,newPod From: https://www.cnblogs.com/WJQ2017/p/18122896