1. 介绍 client-go DeltaFIFO 介绍了从 DeltaFIFO 中取出的资源将被放到 indexer ,接着交由 processorListener 处理。
本文继续看 processorListener 是如何处理 DeltaFIFO pop 的资源的。
2. 启动 handler processorListener 的启动在 sharedIndexInformer.Run() 方法定义:
func (s *sharedIndexInformer) Run(stopCh <-chan struct{}) { ... // 开启协程运行 sharedIndexInformer.processor.run 方法 wg.StartWithChannel(processorStopCh, s.processor.run) ... } func (p *sharedProcessor) run(stopCh <-chan struct{}) { func() { p.listenersLock.RLock() defer p.listenersLock.RUnlock() for listener := range p.listeners { // 开启协程运行 processorListener.run p.wg.Start(listener.run) // 开启协程运行 processorListener.pop p.wg.Start(listener.pop) } p.listenersStarted = true }() <-stopCh ... } sharedProcessor.run 的重点在 processorListener.pop 和 processorListener.run,分别介绍如下。
...