-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
The karmada-controller-manager is a composite of multiple controllers, each of which watches for changes in target resources and performs reconciliation to align the actual state with the desired state.
Currently, the event watching and filtering operations of multiple controllers on target resources are somewhat redundant to a certain extent. If we can eliminate these redundant events or resource changes, it would reduce unnecessary reconciliations by the controllers, thereby enhancing the performance of the controllers to some degree.
The following lists the controllers that can be optimized:
- binding-controller/cluster-resource-binding-controller: There is no need to monitor the deletion events of the ResourceBinding object. Additionally, fine-grained filtering requires attention to the spec field: @rohan-019 Optimize binding controllers with fine-grained event filtering to reduce redundant reconciliations #6784
.spec.requiredBy.spec.clusters.spec.gracefulEvictionTasks.spec.resource.spec.suspension.spec.preserveResourcesOnDeletion.spec.conflictResolution
- cert-rotation-controller: Only need to watch the creation event of the cluster object, as the cluster object will be processed periodically, so there is no need to watch the update or deletion events of the cluster.
- cluster-controller: Only need to watch the creation events of the cluster object, as well as the updates and deletion timestamp changes of the Ready Status Condition (currently watching all events and changes in spec, status, and metadata).
- taint-manager: Only need to watch the creation events of the cluster and the updates to taints (currently watching all events as well as changes in spec, status, and metadata).
- execution-controller: There is no need to watch the deletion event of the Work object, as the work has a finalizer, and the deletion process will handle it by checking whether the deletion timestamp is empty. @rohan-019 Reduce unnecessary watch events in execution-status-controller #6849
- federated-resource-quota-sync-controller: Some todo items have been identified by @zhzhuang-zju and can be optimized according to the plan.
- resource-binding-graceful-eviction-controller/cluster-resource-binding-graceful-eviction-controller: For update events, maintain the existing logic and only monitor changes to the gracefulEvictionTasks field.
- service-export-controller: It is necessary to watch the creation event of the work object, but not for the update event. The judgment of whether the work object contains the ServiceExport resource can be moved to the predicate logic.
- endpointslice-controller: There is no need to watch the deletion event of the work object.
- mcs-controller: Only need to watch for cluster creation and update events. For update events, we need to determine whether the Ready Status Condition of the cluster has changed, as well as whether the support for the EndpointSlice API in APIEnablement has changed.
- endpointslice-collect-controller: There is no need to watch update and deletion events of EndpointSlice Work; the judgment of whether Work contains EndpointSlice resources can be moved to the predicate logic.
- endpointslice-dispatch-controller: There is no need to watch the deletion event of the work object.
- cluster-status-controller: There is no need to watch changes to all fields in the spec of the cluster object, such as taints and resourceModels. @XiShanYongYe-Chang Reduce unnecessary watch events in cluster-status-controller #6832
- work-status-controller: It is necessary to watch the creation event of the work object. Apart from updating the work status to WorkApplied, there is no need to monitor the update and deletion events of the work object. @XiShanYongYe-Chang Reduce unnecessary watch events in the work-status-controller #6813
After completing all optimizations, in order to demonstrate the effects brought by these optimizations, we need to conduct some tests to focus on how much the optimizations can reduce Reconcile.
- Optimization Effect Test