kube-controller-manager如何处理多种cr变更
k8s v1.19.0
以deployment controller为例
pkg/controller/deployment/deployment_controller.go
run函数
处理enqueueDeployment函数写入队列的key namespace/name,与pkg/controller/replicaset/replica_set.go中Run函数类似。
pkg/controller/deployment/deployment_controller.go
syncDeployment函数
处理deployment事件,不支持并发处理同一个deployment。
pkg/controller/deployment/sync.go
getAllReplicaSetsAndSyncRevision函数
获取老rs和新rs,新rs是匹配上最新deploy pod模板的,更新deploy pod模板才会产生新的rs。
pkg/controller/deployment/sync.go
getNewReplicaSet函数
创建新的rs
enqueueDeployment和enqueueReplicaSet区别