|
|
@ -237,13 +237,14 @@ func (r *Reflector) setExpectedType(expectedType interface{}) {
|
|
|
|
// call chains to NewReflector, so they'd be low entropy names for reflectors
|
|
|
|
// call chains to NewReflector, so they'd be low entropy names for reflectors
|
|
|
|
var internalPackages = []string{"client-go/tools/cache/"}
|
|
|
|
var internalPackages = []string{"client-go/tools/cache/"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reflector 启动的方法,参数 stopCh 是一个信号对象,收到停止信号就退出运行
|
|
|
|
// Run repeatedly uses the reflector's ListAndWatch to fetch all the
|
|
|
|
// Run repeatedly uses the reflector's ListAndWatch to fetch all the
|
|
|
|
// objects and subsequent deltas.
|
|
|
|
// objects and subsequent deltas.
|
|
|
|
// Run will exit when stopCh is closed.
|
|
|
|
// Run will exit when stopCh is closed.
|
|
|
|
func (r *Reflector) Run(stopCh <-chan struct{}) {
|
|
|
|
func (r *Reflector) Run(stopCh <-chan struct{}) {
|
|
|
|
klog.V(3).Infof("Starting reflector %s (%s) from %s", r.expectedTypeName, r.resyncPeriod, r.name)
|
|
|
|
klog.V(3).Infof("Starting reflector %s (%s) from %s", r.expectedTypeName, r.resyncPeriod, r.name)
|
|
|
|
wait.BackoffUntil(func() {
|
|
|
|
wait.BackoffUntil(func() {
|
|
|
|
if err := r.ListAndWatch(stopCh); err != nil {
|
|
|
|
if err := r.ListAndWatch(stopCh); err != nil {// 调用了 list & watch
|
|
|
|
r.watchErrorHandler(r, err)
|
|
|
|
r.watchErrorHandler(r, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, r.backoffManager, true, stopCh)
|
|
|
|
}, r.backoffManager, true, stopCh)
|
|
|
|