Kubernetes Client Shared Informer 架构设计源码阅读 | 云原生社区
source link: https://cloudnative.to/blog/kubernetes-client-sharedinformer/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Kubernetes client shared informer 架构设计源码阅读
本文研究了 Kubernetes 中 Client Shared Informer 部分的源码,配备源码进行进一步理解,可以加深理解,增强相关设计能力。
本文研究了 Kubernetes 中 Client Shared Informer 部分的源码,配备源码进行进一步理解,可以加深理解,增强相关设计能力。
Workflow
从接口间关系可以看出,SharedInformer 是核心组件,它通过 Controller 执行操作,并将结果存入 Store 中。SharedIndexInformer 为 SharedInformer 添加了 Index 功能。
Procedure
Add Handler
ListAndWatch
Indexer
[1] cache 根据 Object 生成 Key 的方式如下
[2] items 根据 Key 获取老对象,并设置新对象
[3] updateIndices 代码如下
[4] sharedIndexInformer 在创建 processorListener 时,如果处于工作状态,会调用 indexer 的 List 方法将全部缓存的 object 取出,并发送给新添加的 processorListener。
最终获取全部事件对象位置
本文研究了 Kubernetes 中 Client Shared Informer 部分的源码,是 Client 篇的第一部分,下面是全系列的链接。
暂时只有 Client 和 Scheduler 部分
[1] Others
[2] Basics
[3] API Server
[4] Client
[5] Proxy
[6] Controllers
[7] Scheduler
Copyright © 2021 云原生社区
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK