k8s_informer源码结构解析
2018-04-13 16:44:22 0 举报
k8s_informer源码结构解析
作者其他创作
大纲/内容
watch.Interface
Stop()ResultChan() -chan Event
Queue
Informer
SharedInformer
Config
QueueListerWatcherProcess ProcessFuncObjectType runtime.Object
New(c *Config) Controller
DeltaFIFO
queue []stringkeyFunc KeyFunc
informers.NewSharedInformerFactory(...) SharedInformerFactory
AddEventHandler(handler ResourceEventHandler)HasSynced() boolRun(stopCh -chan struct{})
sharedIndexInformer
controller Controllerprocessor *sharedProcessorlisterWatcher ListerWatcherobjectType runtime.Object
NewSharedIndexInformer(...) SharedIndexInformerHandleDeltas(obj interface{}) error
ListWatch
ListFunc ListFuncWatchFunc WatchFunc
Lister
List(selector labels.Selector)
watch特定资源并将其变动同步到给定的store中
internalinterfaces.SharedInformerFactory
Start(stopCh -chan struct{})InformerFor(...) cache.SharedIndexInformer
controller
config Configreflector *Reflector
New(c *Config) ControllerprocessLoop()
informers.SharedInformerFactory
Extensions() extensions.Interface...
extensions.Interface
V1beta1() v1beta1.Interface
sharedProcessor
listeners []*processorListenerwg wait.Group
Store
Add(obj interface{}) error...
Reflector
name stringstore StoreexpectedType reflect.TypelisterWatcher ListerWatcher
Controller
Run(stopCh -chan struct{})HasSynced() bool
chan Event
SharedIndexInformer
HandleDeltas(obj interface{}) error函数做事件分发处理
ListerWatcher
deploymentInformer
factory internalinterfaces.SharedInformerFactory
NewDeploymentInformer(...) cache.SharedIndexInformer
informers.sharedInformerFactory
client kubernetes.Interfaceinformers map[reflect.Type]cache.SharedIndexInformerstartedInformers map[reflect.Type]bool
WaitForCacheSync(stopCh -chan struct{}) map[reflect.Type]bool
DeploymentInformer
Informer() cache.SharedIndexInformerLister() v1beta1.DeploymentLister
v1beta1.Interface
Deployments() DeploymentInformer...
收藏
0 条评论
下一页