The controller doesn't generate `%s-generated-kubeletconfig-%s` files for new MCPs
We have an OKD cluster with approximately 10 MachineConfigPools (MCPs) that inherit from the worker MCP.
When we add a new MCP, the 97 and 98 kubelet configurations are not generated for it.
They are only created after restarting the Machine Config Controller pod.
I suspect this happens because the kubelet config controller does not register any event handlers on the [MCP informer](https://github.com/openshift/machine-config-operator/blob/main/pkg/controller/kubelet-config/kubelet_config_controller.go#L109). As a result, adding a new MCP does not trigger reconciliation. When the operator is restarted, the FeatureGate informer emits an initial `ADD` event, which then triggers reconciliation and leads to the generation of the missing kubeletConfigs.
To reproduce the issue, watch the MachineConfigs (`oc get machineconfig -w`) and apply a new MCP, for example, as shown below.
The expected behavior is that three MachineConfigs are generated: `97-demo-generated-kubelet`, `98-demo-generated-kubelet`, and `rendered-demo-uuid`.
In practice, only `rendered-demo-uuid` is created. The 97 and 98 kubelet MachineConfigs are generated only after the controller pod is restarted.
```yaml
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
labels:
machineconfiguration.openshift.io/role: demo
pools.operator.machineconfiguration.openshift.io/demo: ""
name: demo
spec:
machineConfigSelector:
matchExpressions:
- key: machineconfiguration.openshift.io/role
operator: In
values:
- worker
- demo
maxUnavailable: 1
nodeSelector:
matchLabels:
node-role.kubernetes.io/demo: ""
paused: false
```
3 条评论