【发布时间】:2018-07-01 17:11:37
【问题描述】:
我正在努力从client-go 项目中深入了解delta_fifo.go。我正在研究一种可能会删除资源删除报告的情况。
我有 98% 的倾向是我自己未能正确阅读代码,但在我看来 Delete() will skip a deletion if it doesn't find an appropriate "event queue" (my term for Deltas) 和 Pop() will remove an event queue that it is processing,即使队列中的最后一个事件是添加的、更新或同步。
假设您从一组空的事件队列(一个空的queue 和空的items)开始,然后您得到以下且仅以下的:
-
Add()调用,eventually sets up or appends to an event queue, -
Pop()调用 which pops it off and chews it up,然后 -
Delete()call。
不会Delete() skip broadcasting the deletion,因为relevant event queue no longer exists?那么既然queueActionLocked()在这种情况下不会被调用,那么是不是意味着任何下游ResourceEventListeners都不会被通知这次删除?
相对稳定的代码链接:
-
Delete: https://github.com/kubernetes/kubernetes/blob/v1.9.0/staging/src/k8s.io/client-go/tools/cache/delta_fifo.go#L201-L205 -
Pop: https://github.com/kubernetes/kubernetes/blob/v1.9.0/staging/src/k8s.io/client-go/tools/cache/delta_fifo.go#L440-L450
非常感谢任何帮助;谢谢!
【问题讨论】:
标签: kubernetes