Operator Pattern 用 Go 扩展 Kubernetes 的最佳实践
在做任何读(get、list)操作时,不能假设读到 的是最新版本,也不能假设一次 reconcile 中始 终会读到同一个版本 避免写后读 同一个 controller,在一次 reconcile 中,避免写 (create、update、delete)完一个对象后马上去 读(get、list)最新版本,等controller-runtime 触发下一次 reconcile 遵循惯例开发模式 即 controller 用读 stale 对象。 如下图所示,某个版本为3(gen=3)的集群(Cluster)中有一个 stale 对象,即 StatefulSet (gen=2)。 Controller-runtime 的 Reconcile 过程是一个 EDA 模型,当该 stale 对象的更新到达 cache 时,controller-runtime 会发送一个事件(Event)给到 owner controller(也就是我们的 controller-type OwnerReference of the given type. // Use Owns(object, builder.MatchEveryOwner) to reconcile all owners. // // By default, this is the equivalent of calling // Watches(object, handler.Enqu0 码力 | 21 页 | 3.06 MB | 9 月前3Service Mesh结合容器云平台的思考和实践
configCh的这个事件会被agent.Run监控到,然后调用agent.reconcile。 3. reconcile方法会启动协程执行agent.waitForExit从而启动envoy看reconcile方法名就知道是用来保证desired config和current config保持一致的。reconcile首先会检查desired config和current config是否一致,如果是的 在调用waitForExit之前会将desiredConfig赋值给currentConfig,表示reconcile工作完成 4. waitForExit会调用agent.proxy.Run,也就是envoy的Run方法,这里会启动envoy。 每次配置发生变化,都会调用agent.reconcile,也就会启动新的envoy,这样envoy越来越多,老的envoy进程怎么办? agent代码的0 码力 | 28 页 | 3.09 MB | 5 月前3Conan 2.10 Documentation
that, Conan uses a “greedy” algorithm that does not require backtracking, but still will try to reconcile version-ranges with fixed versions when possible. The most important point to know about this is0 码力 | 803 页 | 5.02 MB | 10 月前3Conan 2.9 Documentation
that, Conan uses a “greedy” algorithm that does not require backtracking, but still will try to reconcile version-ranges with fixed versions when possible. The most important point to know about this is0 码力 | 795 页 | 4.99 MB | 10 月前3Conan 2.7 Documentation
that, Conan uses a “greedy” algorithm that does not require backtracking, but still will try to reconcile version-ranges with fixed versions when possible. The most important point to know about this is0 码力 | 779 页 | 4.93 MB | 10 月前3Conan 2.8 Documentation
that, Conan uses a “greedy” algorithm that does not require backtracking, but still will try to reconcile version-ranges with fixed versions when possible. The most important point to know about this is0 码力 | 785 页 | 4.95 MB | 10 月前3
共 6 条
- 1