controller: Start sub-controllers in order of dependency
The render controller needs kubelet data, so start it first.
And add a bit of docs.
@@ -79,6 +79,7 @@ func runStartCmd(cmd *cobra.Command, args []string) {
}
func startControllers(ctx *common.ControllerContext) error {
+ // Our primary MCs come from here
go template.New(
rootOpts.templates,
ctx.InformerFactory.Machineconfiguration().V1().ControllerConfigs(),
@@ -87,6 +88,18 @@ func startControllers(ctx *common.ControllerContext) error {
ctx.ClientBuilder.MachineConfigClientOrDie("template-controller"),
).Run(2, ctx.Stop)
+ // Add all "sub-renderers here"
+ go kubeletconfig.New(
+ rootOpts.templates,
+ ctx.InformerFactory.Machineconfiguration().V1().MachineConfigPools(),
+ ctx.InformerFactory.Machineconfiguration().V1().ControllerConfigs(),
+ ctx.InformerFactory.Machineconfiguration().V1().KubeletConfigs(),
+ ctx.ClientBuilder.KubeClientOrDie("kubelet-config-controller"),
+ ctx.ClientBuilder.MachineConfigClientOrDie("kubelet-config-controller"),
+ ).Run(2, ctx.Stop)
+
+ // The renderer creates "rendered" MCs from the MC fragments generated by
+ // the above sub-controllers, which are then consumed by the node controller
go render.New(
ctx.InformerFactory.Machineconfiguration().V1().MachineConfigPools(),
ctx.InformerFactory.Machineconfiguration().V1().MachineConfigs(),
@@ -94,6 +107,7 @@ func startControllers(ctx *common.ControllerContext) error {
ctx.ClientBuilder.MachineConfigClientOrDie("render-controller"),
).Run(2, ctx.Stop)
+ // The node controller consumes data written by the above
go node.New(
ctx.InformerFactory.Machineconfiguration().V1().MachineConfigPools(),
ctx.KubeInformerFactory.Core().V1().Nodes(),
@@ -101,14 +115,5 @@ func startControllers(ctx *common.ControllerContext) error {
ctx.ClientBuilder.MachineConfigClientOrDie("node-update-controller"),
).Run(2, ctx.Stop)
- go kubeletconfig.New(
- rootOpts.templates,
- ctx.InformerFactory.Machineconfiguration().V1().MachineConfigPools(),
- ctx.InformerFactory.Machineconfiguration().V1().ControllerConfigs(),
- ctx.InformerFactory.Machineconfiguration().V1().KubeletConfigs(),
- ctx.ClientBuilder.KubeClientOrDie("kubelet-config-controller"),
- ctx.ClientBuilder.MachineConfigClientOrDie("kubelet-config-controller"),
- ).Run(2, ctx.Stop)
-
return nil
}
